html2pdf custom font not working


I tried many things to get the html2pdf extension to use custom fonts or even the Arial font when generating a htmlpage to pdf. When I visit the html page the font is visible and everything is working fine. But when the html2pdf generator creates the pdf it's not working. I uploaded a woff and ttf file to the espace and added the following code to the css of the page that is being converted to the pdf:

@font-face {
font-family: 'TestArial';
src: url(''); font-weight: normal; font-style: normal;

If you have any feedback please let me know!
Hi freek,

It seems some people have also struggled with this while using wkhtml (the underlying component beneath html2pdf). There's a thread on stack overflow about it.

Perhaps you can try their solution an use un escaped expressions to include the styles in your page.

Hi Guilherme,

Thnx for the feedback I was able to include the google fonts so that is working now. In the future I will to to change it back to have a custom font on the server.

Hi Guilherme this was an excelent tip, was suffering from the same issue on my application, page that would be converted to pdf was not reaching the font that it needed on the pdf, but on my cause everything got sorted out by using silk ui fonts, either way you tip pointed me in the right direction, thanks.

Best Regards,