如何在名为FPDI的PHP库中设置UTF-8编码?
这是库:https://www.setasign.com/products/fpdi/manual/
代码:
$pdf = new Fpdi();
$pdf->AddPage();
$pdf->setSourceFile('PdfDocument.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 10, 10, 100);
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'Zażółcić gęślą jaźń');
$pdf->Output();
FPDI
库使用FPDF
、TCPDF
或tFPDF
来为它们添加PDF文件导入支持。FPDF不支持UTF-8编码。tFPDF
是FPDF
的替代品,它增加了UTF-8支持。但是,您仍然需要手动添加您的UTF-8字体,或将其添加到您的fonts/unifont
目录中。 - Will B.'mode' => 'utf-8'
。可以看一下。 - Petschko