0

I need to write Chinese in PDF documents using FPDF. I already have a source file which is the Registration form. I need to write the Chinese Name in the Source PDF.

I tried many fonts like MSJH, Code200365k, and Microsoft Yahei. But when I included those fonts, PDF will generate diamonds or question marks.

Following is my source code using Code200365k font. But it didn't work as well

<?php
use setasign\Fpdi\Fpdi;

require_once('vendor/autoload.php');

$pdf = new Fpdi();

$pdf->AddPage();
$pdf->setSourceFile("src/registration-form.pdf");
$tplId = $pdf->importPage(1);
$pdf->useTemplate($tplId, 10, 10, 200);

$pdf->AddFont('Code200365k', '', 'Code200365k.php');

$pdf->SetFont('Code200365k','',10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(50, 59);
$pdf->Write(0, '林夕夕');
$pdf->Output();

I need to write Chinese Font in PDF file using FPDF.

  • 1
    Does this answer your question? [Issues with Chinese characters in FPDF](https://stackoverflow.com/questions/30358439/issues-with-chinese-characters-in-fpdf) – double-beep May 29 '23 at 11:01
  • Use FPDI with TCPDF (see [here](https://www.setasign.com/products/fpdi/demos/tcpdf-demo/)). – Olivier May 30 '23 at 07:13

0 Answers0