Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make DOMPDF support unicode font step by step?

I used DOMPDF library and now I have problem with content with unicode language. and I found this one dompdf help but I don't understand about this. can anyone tell the detail of this? thanks

like image 283
Piseth Sok Avatar asked Dec 12 '22 06:12

Piseth Sok


1 Answers

  1. Enable the mbstring extension
  2. Find a font in .ttf format with characters that support your given language
  3. Generate a .afm file for DOMPDF:
    1. Using the command line, cd into the directory which contains load_font.php, then run php load_font.php FontName /path/to/font.ttf
    2. Using the online tool, fill out the form and download the zip it gives you. Copy the files from this zip into dompdf/lib/fonts. If you've done this before, add relevant lines to dompdf_font_family_cache, otherwise simply rename the dompdf_font_family_cache.sample to dompdf_font_family_cache
  4. Enable DOMPDF's Unicode mode, by making sure the line

    define("DOMPDF_UNICODE_ENABLED", true);
    

    is set in dompdf_config.inc.php. If it reads false instead of true, change that.

like image 65
Ryan McCue Avatar answered Dec 28 '22 11:12

Ryan McCue