Home > Article > Backend Development > What to do if php fpdf Chinese garbled characters
php Solution to fpdf Chinese garbled characters: first download fpdf; then download the Chinese package, and put the file in the folder at the same level as "fpdf.php"; finally edit the content of "ex.php" Just "$pdf=new PDF_Chinese();".
Recommended: "PHP Video Tutorial"
php uses fpdf garbled problem
Step 1. First download fpdf http://www.fpdf.org/en/download.php (I am using version 1.7)
Step 2. Download the Chinese package http://www .fpdf.org/download/chinese.zip After downloading, place the file in the folder of step 1 under the same directory as fpdf.php
Step 3. Edit the ex.php content as follows
<?php require('chinese.php'); $pdf=new PDF_Chinese(); $pdf->AddGBFont('simsun','宋体'); $pdf->AddGBFont('simhei','黑体'); $pdf->AddGBFont('simkai','楷体_GB2312'); $pdf->AddGBFont('sinfang','仿宋_GB2312'); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont('simsun','',20); $pdf->Write(10,'简体中文汉字'); $pdf->SetFont('simhei','',20); $pdf->Write(10,'简体中文汉字'); $pdf->SetFont('simkai','',20); $pdf->Write(10,'简体中文汉字'); $pdf->Write(10,'简体中文汉字'); $pdf->Output(); ?>
You can see Chinese by previewing directly.
The above is the detailed content of What to do if php fpdf Chinese garbled characters. For more information, please follow other related articles on the PHP Chinese website!