kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
163 stars 149 forks source link

Unicode rendering issue #63

Closed induwarabas closed 7 years ago

induwarabas commented 7 years ago

I am trying to create a pdf with unicode characters. But it render squares instead of unicode characters. Is there any additional configuration for unicode rendering? I tried different characters like আসসালামু আলাইকুম નમસ્તે നമസ്കാരം नमस्ते வணக்கம்!මාගේ අංකය: 02/05/F/01/06. All of them are rendered to squares.

kartik-v commented 7 years ago

Set mode property within the Pdf component to Pdf::MODE_UTF8 for unicode support. You can read more about setting fonts in the Mpdf docs.

induwarabas commented 7 years ago

Thanks! But simply changing the MODE did not work. I did it by changing the font using html styles. Also I tried to use Sinhala language. It did not processed properly. As an example if I typed ග්‍රාමිය, it shows ග්රාමිය. Actually this happens when there is a unicode processing issue. Anyway, I did it by using sinhala font, instead of using unicode font.