首页 > 解决方案 > 使用 mpdf 6.1 加载 PDF 文档失败

问题描述

我在我的系统和 mpdf 6.1 中使用 codeigniter 来生成 pdf。每次打开新标签页进行预览时,我都会在 chrome 中收到错误“无法加载 PDF 文档”。那有什么问题?我要打印的 html 代码:

include_once APPPATH . 'third_party/mPDF/mpdf.php';

$title= 'customer';
$html .= '<html>';
$html .= '<body>';
$html .= '<table>';
$html .= '</table>';
$html .= '</body>';
$html .= '</html>';
$mpdf = new mPDF('c', 'A4', '', '', 10, 10, 55, 20, 10, 10);
$mpdf->SetProtection(array('print'));
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->setTitle($title);
$mpdf->Output(url_title($title.'.pdf'), 'i');

谢谢 :)

标签: htmlcodeignitergoogle-chromepdfmpdf

解决方案


推荐阅读