Skip to content
Advertisement

How to add TTF font to html2pdf PHP program

I’m trying to use HTML2PDF 4.03 with this code:

JavaScript

Now the program die with this:

JavaScript

How can I add TTF font to my PDF file?

Advertisement

Answer

I have managed to add 1 custom font to my setup using the following method.

First convert the .ttf file to 3 separate files (.php .z and .ufm) using the following font converter Place the 3 files that are generated by this system into the fonts folder in TCPDF.

Now you can set the default font for your PDF using the following command

JavaScript

This was fairly simple to get working, I am having issues using 2 seperate fonts though via this method. I’ll figure it out though

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement