How to write Bengali (Bangla বাংলা)
unicode PDF file using PHP?
Solution:
Now a days Bengali is using a lot on
Computer based system. So developers need generate Bangla PDF file
frequently. But generating Bangla pdf is
not so easy as it is complex script. In this tutorial I will use mpdf 6.0 library for PDF generation and nikosh.ttf as
Bangla unicode font. If you are not familiar with mpdf, but using fpdf, don't
worry. mpdf is similar with fpdf with very little change.
Step
01: First of all, we need to download mpdf library and nikosh.ttf unicode
Bangla font.
Step 02: Now, copy nikosh.ttf font file on /ttfonts folder of mpdf library.
Step 02: Now, copy nikosh.ttf font file on /ttfonts folder of mpdf library.
Step 03: For add any font the major task is to change config_fonts.php file of mpdf. As Bangla has similarity with Indic language so I will add Bangla font (Nikosh) information after Indic.
That's it. We are done. Now we can generate Bangla PDF files using php.
If you don't want to go through those process, you could just download my modified mpdf from here.
Or you could just download config_fonts.php and example file individualy.
Or you could just download config_fonts.php and example file individualy.