PHP: TCPDF Font style Change(Adding external fonts)

TCPDF is a PDF library for generating PDF for given content. The Library is open source available on We can download that library to create PDF for our need. This article will demonstrate how to change default font style of TCPDF library with our custom TTF font file.

Below is the essential steps to follow to change the font style.

1. Get TCPDF Library from Online
2. Set Library in your local server
3. Example PDF generators

4. Get new font file (TTF format) from online
5. Generate Font library for the new font file. 

 php tcpdf/tools/tcpdf_addfont.php -i tcpdf/fonts/NEW_FONT.ttf   

  It will generate new 2 Zipped folders(NEW_FONT.z and NEW_FONT.ctg.z) and one PHP file(NEW_FONT.php) of Font style configuration.
6. Set new font format to PDF file generator 

$pdf->SetFont(NEW_FONT, NULL, 8);