public function get($html){ $content=$this->fetch($html); Vendor('mpdf.mpdf'); //實例化mpdf $mpdf=new mPDF('UTF-8','A4','','宋體',20,20); //設置字體,解決中文亂碼 $mpdf->useAdobeCJK = true; $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->writeHTML($content); $mpdf->Output(iconv("utf-8","gb2312","aaa.pdf"),true); //$mpdf->Output(); exit; }
網上找的代碼,拿來借鑒,發在博客里,以備查看
網上說mpdf解決中文亂碼問題很有效,親測的確,但別到處pdf的插件沒有測試。