PDF generation was an old request by one of our client. Our team struggled a lot to solve this.
The root problem was font. We were in need of such font which can support UTF-8 characters. But none of the PHP libraries were having such support by default. Finally we selected TCPDF as the PDF generation library because it has Unicode supports and able to generate UTF-8 PDF in the presence of suitable font.

Here are the steps by which we solved this issue.

1. Searched the font supported by UTF-8 encoding and selected “osaka.unicode.ttf” as it was best matching to our requirement. Copied it into the TCPDF’s utils folder.
2. Converted it to the font’s metrics file.
- Changed the font file name to lower case.
- Used a PHP script “makeallttffonts.php” to convert the ttf file to font’s metrics file. This script comes by default with TCPDF.
- Copied generated font map files (only osaka.unicode.ctg.z, osaka.unicode.z, osaka.unicode.php)to the font’s directory.
3. Used the font name during PDF generation.