How do you add custom fonts in TCPDF?

I figured out my issue, I was almost there. Here is a step by step: First convert your font using the tcpdf_addfont.php tool font in the TCPDF tools folder: php/tcpdf/tools/tcpdf_addfont.php -i php/font/rumpelstiltskin-webfont.ttf This will generate the required files and put them in the TCPDF fonts folder. Check the fonts folder and copy the name of … Read more

TCPDF not render all CSS properties

In the first place, you should note that PDF and HTML and different formats that hardly have anything in common. If TCPDF allows you to provide input data using HTML and CSS it’s because it implements a simple parser for these two languages and tries to figure out how to translate that into PDF. So … Read more

Why does TCPDF ignore my inline CSS?

TCPDF has a very limited CSS support. It doesn’t support all attributes. Currently, only the following CSS attributes are supported: font-family font-size font-weight font-style color background-color text-decoration width height text-align So try removing the other attributes, and tell if it works. Also, this is an active forum for TCPDF related discussion. TCPDF Documentation Alternatives to … Read more

TCPDF UTF-8 symbols not showing up

TCPDF is quite tricky with utf8. Best way to achieve what you want is to embed the font in generated PDF file itself. You can use freeserif font from the TCPDF package, it contains all the utf8 symbols, shows absolutely any character of any language, but adds ~700kb to the output file. That’s probably the … Read more

How to implement custom fonts in TCPDF

The latest TCPDF version automatically convert fonts into TCPDF format using the addTTFfont() method. For example: // convert TTF font to TCPDF format and store it on the fonts folder $fontname = TCPDF_FONTS::addTTFfont(‘/path-to-font/FreeSerifItalic.ttf’, ‘TrueTypeUnicode’, ”, 96); // use the font $pdf->SetFont($fontname, ”, 14, ”, false); For further information and examples, please check the TCPDF Fonts … Read more