Search code examples
phpcodeignitertcpdf

Adding new fonts in TCPDF


Does anybody can help me how to install or add new font in TCPDF. I already got the .z,php and .ttf file in my font. And how to display or use the font.. I stored the given file into fonts folder.
I used CodeIgniter.


Solution

  • You can do the below thing. If you have .ttf file for the new font then convert that font to .php and .z files using below link http://www.xml-convert.com/en/convert-tff-font-to-afm-pfa-fpdf-tcpdf

    Once you converted the fonts download the .php and .z file and upload it into tcpdf's fonts folder. TCPDF will consider your filename as your fontname so make sure you have correct file names.

    Once files are uploaded you can directly use setfont function of tcpdf.