Add Bangla Font (ex: solaimanlipi) or other ttf font to mpdf

MPDF is a great tool to work with UTF-8 complex texts such as Bangla and indic scripts. You can add your own fonts to MPDF and use it with CSS properties as well.

1. just add this line in your config_fonts.php file inside the mpdf folder (user 6.0 or latest) “solaimanlipi” => array( ‘R’ => “SolaimanLipi.ttf”, ‘useOTL’ => 0xFF, ),

2. copy the solaimanlipi.ttf inside the ttfonts folder.

3. change your css styles for the PDF scripts.

body, p, div { font-size: 14pt; font-family: solaimanlipi;}

h3 { font-size: 15pt; margin-bottom:0; font-family: solaimanlipi; }

4. now run it, you will have the solaimanlipi integrated in mpdf.

 

you can do it with other unicode font as well

Leave a Reply

Your email address will not be published. Required fields are marked *