PHP uses fpdf garbled problem

Source: Internet
Author: User

Step 1, First download fpdf http://www.fpdf.org/en/download.php (I use the 1.7 version)

Step 2, download the Chinese package http://www.fpdf.org/download/chinese.zip download After the file is placed in the Step 1 folder with the fpdf.php sibling directory below

Step 3, edit ex.php content as follows

<?PHPrequire(' chinese.php ');$pdf=NewPdf_chinese ();$pdf->addgbfont (' SimSun ', ' song Body '); $pdf->addgbfont (' Simhei ', ' blackbody '); $pdf->addgbfont (' Simkai ', ' italics _gb2312 ')); $pdf->addgbfont (' Sinfang ', ' imitation _gb2312 '); $pdf-Open ();$pdf-AddPage ();$pdf->setfont (' SimSun ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->setfont (' Simhei ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->setfont (' Simkai ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->write (10, ' Simplified Chinese characters ')); $pdf-Output ();?>

You can see the Chinese in the direct preview.

PHP uses fpdf garbled problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.