发送邮件时将html转换为pdf

时间:2018-07-12 12:41:19

标签: codeigniter

发送邮件时如何在CODEIGNITER中将HTML文件转换为PDF?

$this->load->library('html2pdf');

$this->html2pdf->folder('./assets/pdfs/');
$this->html2pdf->filename('email_test.pdf');
$this->html2pdf->paper('a4', 'portrait');

$data = array(
    'title' => 'PDF Created',
    'message' => 'Hello World!'
);
//Load html view
$this->html2pdf->html($this->load->view('pdf', $data, true));

//Check that the PDF was created before we send it
$path = $this->html2pdf->create('save');

我使用此代码进行转换。

1 个答案:

答案 0 :(得分:0)

也许您可以尝试一直对我有用的TCPDF :) TCPDF INTEGRATION CI