wyynts
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的插件没有测试。

分类:

技术点:

相关文章: