无法在我的远程服务器上保存生成的pdf



我正在尝试将生成的pdf保存在自定义文件夹中,但没有保存。我想以pdf格式作为附件发送到电子邮件中这是我的代码生成和保存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();
}

我不确定我的文件夹放在哪里,我也在添加我的文件夹布局图片https://i.stack.imgur.com/tUadw.png

尝试为输出函数添加一个更完整的路径。类似于:

$pdf->output(FCPATH . "my/directory/path/" . "pdfName.pdf", 'F');

相关内容

  • 没有找到相关文章

最新更新