废话不多说了,直接奔入主题了。
推荐教程:php使用mpdf类生成pdf的方法
1.config.php文件,大约67行:
$this->autolangtofont = true;
2.使用的时候
注意, +acjk 这个参数,而不是 c这个参数
$mpdf=new mpdf('+acjk','a4','','',32,25,27,25,16,13);
$mpdf->writehtml($content);
$mpdf->output();
然后就输出中文了
这个针对版本mpdf6.0
ps:mpdf生成中文乱码的解决方法
useadobecjk = true;
$mpdf->setautofont(autofont_all);
$mpdf->setdisplaymode('fullpage');
//$mpdf->watermark_font = 'gb';
//$mpdf->setwatermarktext('中国水印',0.1);
$url = 'http://www.kuitao8.com/';
$strcontent = file_get_contents($url);
//print_r($strcontent);die;
$mpdf->showwatermarktext = true;
$mpdf->setautofont();
//$mpdf->sethtmlheader( '头部' );
//$mpdf->sethtmlfooter( '底部' );
$mpdf->writehtml($strcontent);
$mpdf->output('ss.pdf');
//$mpdf->output('tmp.pdf',true);
//$mpdf->output('tmp.pdf','d');
//$mpdf->output();
exit;
?>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!