I cannot get TCPDF
display any chinese character no matter what font I am using.
I crawled and searched everywhere I could, including these interesting posts
tcpdf-utf-8-problem
tcpdf-encode-chinese-character
but still without success.
The sample #7 from TCPDF
works well with a lot of different characters sets but if I add some Chinese to the text it will display as squares and the strangest thing is if I change the font to stsongstdlight
as suggested in one message the text won't display at all - but the header will.
The sample #38 from TCPDF
with Japanese font doesn't work either.
Thanks for any advice that could let me find new ideas to try.
I just tested setting the font like
$pdf->SetFont('kozminproregular', '', 12);
as suggested in tcpdf encode chinese character and it seemed to work fine.
Here is the sample from my output:
Main problem is due to evince PDF reader cannot handle the CJK Chinese generated by TCPDF.
after
sudo apt-get install poppler-data
Everything started to get better !
I use the font stsongstdlight which is designed for Chinese unlike the kozminproregular which looks like designed for Japanese. However I have still an issue with the spacing of non Chinese character, there is very big spaces after all T,i,u...
To solve this second issue I convert and use the fonts arialuni.ttf but this font is not open source nor free. I tried to convert many other unicode fonts which include Chinese without success.
sources :
- evince – ubuntu PDF reader – can’t display CJK chinese
- creating-pdfs-using-tcpdf-that-supports-all-languages-especially-cjk