Home >Backend Development >PHP Tutorial >How to solve Chinese garbled characters in PHP MPDF
This article mainly introduces how to solve the Chinese garbled characters in PHP MPDF. Interested friends can refer to it. I hope it will be helpful to everyone.
ps: Solution to mpdf generating Chinese garbled characters
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; ?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's learning.
Related recommendations:
A simple way to download files in php and add response headers
How to use php to download files by clicking on the current page
PHP simply implements the method of uploading files, videos, etc. using FTP class
The above is the detailed content of How to solve Chinese garbled characters in PHP MPDF. For more information, please follow other related articles on the PHP Chinese website!