Not able to save generated pdf on my remote server
up vote
0
down vote
favorite
I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email
Here is my code generate and save pdf
public function email($timestamp=0, $load_id=0, $type=0)
$this->load->library('tcpdf/Pdf');
$pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false);
$pdf->SetTitle('Document');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetHeaderMargin(10);
$pdf->SetLeftMargin(10);
$pdf->SetRightMargin(10);
$pdf->SetTopMargin(10);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetAuthor('Author');
$pdf->SetDisplayMode('real', 'default');
$pdf->Write(5, 'Cal Sierra Load Document'); // add a page
$pdf->AddPage();
// $carriers = $this->admin_model->getCarriers(array(), array(), 0,0,1,"","","",1);
$load=$this->admin_model->getLoad($load_id);
$pickupDrops=$this->admin_model->getPickupDrops(0,0,1,0,$load_id);
$loadPickups=array();
$loadDrops=array();
if(!empty($pickupDrops))
foreach($pickupDrops as $row)
if($row['type']==1)
$loadPickups=$row;
else
$loadDrops=$row;
$data['load'] = $load;
$data['loadPickups'] = $loadPickups;
$data['loadDrops'] = $loadDrops;
// $data['carriers'] = $carriers;
$data['settings'] = $this->settings_model->getSettingsFile();
$data['currentTime'] = $timestamp;
// echo "<pre>";
// print_r($data);
// exit();
switch ($type)
case 1:
$html = $this->load->view('documents/doc1', $data, true);
break;
case 2:
$html = $this->load->view('documents/doc2', $data, true);
break;
case 3:
$html = $this->load->view('documents/doc3', $data, true);
break;
default:
$pdf->Output('custom'.'Document.pdf', 'F');
$this->Output("custom");
exit();
I am not sure where put my folder to pdf i am also adding my folder layout picture https://i.stack.imgur.com/tUadw.png
codeigniter
add a comment |
up vote
0
down vote
favorite
I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email
Here is my code generate and save pdf
public function email($timestamp=0, $load_id=0, $type=0)
$this->load->library('tcpdf/Pdf');
$pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false);
$pdf->SetTitle('Document');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetHeaderMargin(10);
$pdf->SetLeftMargin(10);
$pdf->SetRightMargin(10);
$pdf->SetTopMargin(10);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetAuthor('Author');
$pdf->SetDisplayMode('real', 'default');
$pdf->Write(5, 'Cal Sierra Load Document'); // add a page
$pdf->AddPage();
// $carriers = $this->admin_model->getCarriers(array(), array(), 0,0,1,"","","",1);
$load=$this->admin_model->getLoad($load_id);
$pickupDrops=$this->admin_model->getPickupDrops(0,0,1,0,$load_id);
$loadPickups=array();
$loadDrops=array();
if(!empty($pickupDrops))
foreach($pickupDrops as $row)
if($row['type']==1)
$loadPickups=$row;
else
$loadDrops=$row;
$data['load'] = $load;
$data['loadPickups'] = $loadPickups;
$data['loadDrops'] = $loadDrops;
// $data['carriers'] = $carriers;
$data['settings'] = $this->settings_model->getSettingsFile();
$data['currentTime'] = $timestamp;
// echo "<pre>";
// print_r($data);
// exit();
switch ($type)
case 1:
$html = $this->load->view('documents/doc1', $data, true);
break;
case 2:
$html = $this->load->view('documents/doc2', $data, true);
break;
case 3:
$html = $this->load->view('documents/doc3', $data, true);
break;
default:
$pdf->Output('custom'.'Document.pdf', 'F');
$this->Output("custom");
exit();
I am not sure where put my folder to pdf i am also adding my folder layout picture https://i.stack.imgur.com/tUadw.png
codeigniter
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email
Here is my code generate and save pdf
public function email($timestamp=0, $load_id=0, $type=0)
$this->load->library('tcpdf/Pdf');
$pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false);
$pdf->SetTitle('Document');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetHeaderMargin(10);
$pdf->SetLeftMargin(10);
$pdf->SetRightMargin(10);
$pdf->SetTopMargin(10);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetAuthor('Author');
$pdf->SetDisplayMode('real', 'default');
$pdf->Write(5, 'Cal Sierra Load Document'); // add a page
$pdf->AddPage();
// $carriers = $this->admin_model->getCarriers(array(), array(), 0,0,1,"","","",1);
$load=$this->admin_model->getLoad($load_id);
$pickupDrops=$this->admin_model->getPickupDrops(0,0,1,0,$load_id);
$loadPickups=array();
$loadDrops=array();
if(!empty($pickupDrops))
foreach($pickupDrops as $row)
if($row['type']==1)
$loadPickups=$row;
else
$loadDrops=$row;
$data['load'] = $load;
$data['loadPickups'] = $loadPickups;
$data['loadDrops'] = $loadDrops;
// $data['carriers'] = $carriers;
$data['settings'] = $this->settings_model->getSettingsFile();
$data['currentTime'] = $timestamp;
// echo "<pre>";
// print_r($data);
// exit();
switch ($type)
case 1:
$html = $this->load->view('documents/doc1', $data, true);
break;
case 2:
$html = $this->load->view('documents/doc2', $data, true);
break;
case 3:
$html = $this->load->view('documents/doc3', $data, true);
break;
default:
$pdf->Output('custom'.'Document.pdf', 'F');
$this->Output("custom");
exit();
I am not sure where put my folder to pdf i am also adding my folder layout picture https://i.stack.imgur.com/tUadw.png
codeigniter
I am trying to save generated pdf in custom folder but its not saving. I want to pdf to send as attachment in email
Here is my code generate and save pdf
public function email($timestamp=0, $load_id=0, $type=0)
$this->load->library('tcpdf/Pdf');
$pdf = new Pdf('P', 'mm', 'LETTER', true, 'UTF-8', false);
$pdf->SetTitle('Document');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetHeaderMargin(10);
$pdf->SetLeftMargin(10);
$pdf->SetRightMargin(10);
$pdf->SetTopMargin(10);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetAuthor('Author');
$pdf->SetDisplayMode('real', 'default');
$pdf->Write(5, 'Cal Sierra Load Document'); // add a page
$pdf->AddPage();
// $carriers = $this->admin_model->getCarriers(array(), array(), 0,0,1,"","","",1);
$load=$this->admin_model->getLoad($load_id);
$pickupDrops=$this->admin_model->getPickupDrops(0,0,1,0,$load_id);
$loadPickups=array();
$loadDrops=array();
if(!empty($pickupDrops))
foreach($pickupDrops as $row)
if($row['type']==1)
$loadPickups=$row;
else
$loadDrops=$row;
$data['load'] = $load;
$data['loadPickups'] = $loadPickups;
$data['loadDrops'] = $loadDrops;
// $data['carriers'] = $carriers;
$data['settings'] = $this->settings_model->getSettingsFile();
$data['currentTime'] = $timestamp;
// echo "<pre>";
// print_r($data);
// exit();
switch ($type)
case 1:
$html = $this->load->view('documents/doc1', $data, true);
break;
case 2:
$html = $this->load->view('documents/doc2', $data, true);
break;
case 3:
$html = $this->load->view('documents/doc3', $data, true);
break;
default:
$pdf->Output('custom'.'Document.pdf', 'F');
$this->Output("custom");
exit();
I am not sure where put my folder to pdf i am also adding my folder layout picture https://i.stack.imgur.com/tUadw.png
codeigniter
codeigniter
asked Nov 9 at 20:13
Aman
15
15
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try adding a more complete path to the output function. Something like:
$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try adding a more complete path to the output function. Something like:
$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
add a comment |
up vote
0
down vote
Try adding a more complete path to the output function. Something like:
$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
add a comment |
up vote
0
down vote
up vote
0
down vote
Try adding a more complete path to the output function. Something like:
$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');
Try adding a more complete path to the output function. Something like:
$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');
answered Nov 13 at 21:31
Colby Boren
838
838
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
add a comment |
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
$pdf->Output(FCPATH . 'home/cal_user/calsierra/uploads/docs/" . "Document.pdf', 'F'); exit();
– Aman
Nov 14 at 15:23
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
I added like this but it just open the new window without saving the pdf
– Aman
Nov 14 at 15:24
and it gives no error
– Aman
Nov 14 at 15:27
and it gives no error
– Aman
Nov 14 at 15:27
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
Make sure your path is correct. It may help to var_dump(FCPATH) so that you see where it is going. Just a note, if you are not trying to save this in your applications directory you won't be able to use FCPATH. You will have to write the full path yourself.
– Colby Boren
Nov 14 at 17:13
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
finally got it working $filename = 'Document.pdf'; $pdfFilePath = "/var/www/html/calsierra/uploads/docs/$filename"; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output($pdfFilePath, 'F');
– Aman
Nov 14 at 17:47
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232712%2fnot-able-to-save-generated-pdf-on-my-remote-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown