首页 > 代码库 > php导出pdf

php导出pdf

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;
    }

  

网上找的代码,拿来借鉴,发在博客里,以备查看

php导出pdf