Skip to content
Advertisement

How to use mPDF for Chinese Language

I am using mPDF to save form input data to PDF. For English, it is working fine. Anyone can use this code to save HTML Form data to PDF.

Issue: In order to fulfill my project requirement I need to use the Chinese Language. My current code is not working for that.

Form.html

JavaScript

processPDF.php

JavaScript

The problem I am having is: In the input field, I typed 怎么用中文说话 and it prints ��������.

If you want to download the source code here is the link to the code

Advertisement

Answer

Do not use 'c' as a $mode parameter, that means PDF core fonts only and they do not support chinese characters.

Try '+aCJK' or '-aCJK' instead.

See examplefiles using chinese font.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement