Home  >  Article  >  Backend Development  >  How to solve Chinese garbled characters in PHP MPDF

How to solve Chinese garbled characters in PHP MPDF

墨辰丷
墨辰丷Original
2018-06-05 17:17:353741browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn