Chinese font support in PDF

Hello,

I installed the latest version on a test machine and entered some Chinese in 3rd party module. but when generating PDF, no matter in invoice or other modules, Chinese font are out of the field.

Chinese can be displayed correctly, but not in the right place.

What could be the problem?

OS: Windows 2008 R2 English

Thanks
Dennis

Pièces jointes :

Hello,

Try to read that from the wiki http://wiki.dolibarr.org/index.php/Create_a_PDF_document_template#Q:My_PDF_template_doesn.27t_understand_foreign_characters.2C_it_outputs_them_as.3F.3F.3F

I managed to get Chinese correctly shown in the PDF using cid0cs font, it should work fine for you as well.

Rgds.

Ji Humphrey,
Thanks for the quick reply.
I have already read this doc before. After changed pdffont to cid0cs, Chinese can be displayed correctly as you can see in the attachment. But numbers are much big and wide.
Is there any setting to adjust number font?

Thanks

Also English letters are same as number.

Hi,
That’s weird… here is what I get with Dolibarr 3.2.3

Before clicking on generate the PDF, did you select Chinese as language (just next to the PDF model selector) ?

Which version of Dolibarr are you using ?

Rgds.

capture.pdf (29.6 KB)

ni hao

You can try using the files from the attachment

Desktop.zip (182 KB)

Copy cid0cs.php into …\includes\tcpdf\fonts\

Replace the Chinese files folder into …\langs\

Make a prior backup of your own files !

These are the ones I use without problem.

Rgds.

Hi Humphrey,

I compared your file and mine, they are exactly same. I enabled the mutilanguage support, download your files and overwrite, selcec Chinese before generate PDF. but no change. My verions is v3.3.1

That’s working fine with 3.2.3… perhaps the issue is with 3.3.1 but I don’t use this version yet, sorry cannot be of more help.

Regards.

Hi Humphrey,

i tested on 3.2.3. It is working perfect. I will switch to this version.
Thanks very much for the help. REALLY helpful.

With Dolibarr 3.3.1, you can try to edit language file to set

FONTFORPDF=msungstdlight
or
FONTFORPDF=stsongstdlight

Hello everyone

i am just trying to make Dolibarr work for our chinese office, so far so good, only when i try to print a form ( proposal or order ) to print in simplifid chinese the form messes up, see attachments. I have changed FONTFORPDFto msungstdlight and cid0cs in main.lang,orders.lang and propal.lang but with no better results. Does someone have a good advice for me? i really would like to get Dolibarr working.

Dolibarr 3.3.1

Many thanks in advance and have a nice weekend

PROV13.pdf (18.6 KB)

PROV14.pdf (20 KB)

Pièces jointes :

Hello,

Spent some time on that issue and found a temporary fix to get Chinese PDF working on Dolibarr 3.3.1:

. replace the file …\includes\tcpdf\tcpdf.php by the one from the attached zip

. change FONTFORPDF=stsongstdlight to FONTFORPDF=cid0cs in …\langs\zh_CN\main.lang (that’s for simplified Chinese, if you use Traditional Chinese so change the font to cid0ct instead)

Anyway that’s working for me so hopefully it may help you as well.

Rgds.

tcpdf_5.zip (190 KB)

Hello Humphrey,

well done many thanks, works fine for us too.

xie xie :smiley:

bu ke qi :wink:

Hi

I had problems in Chinese PDF with 8.0.1 and 8.0.2.

DOLIBARR ENVIRONMENT
- Version: 8.0.2 / 8.0.1
- Operating System: Linux (Bluehost shared hosting plan)
- Web Server: nginx/1.14.0 (Bluehost shared hosting plan)
- PHP: PHP 5.6
- Database: 5.6.32-78.1 - Percona Server (GPL), Release 78.1, Revision 8bb53b6
- URL(s): http://uxd.tw/dolibarr/

CO1809-0001.pdf (232 KB)

And, I also change
FONTFORPDF=DejaVuSans
into htdocs/langs/zh_tw/main.lang

Please advise and thanks!