hajareshyam / pdf-creator-node

This package is used to generate HTML to PDF in Nodejs
MIT License
238 stars 80 forks source link

How to use custom font #123

Open avocadolabsrepo opened 3 months ago

avocadolabsrepo commented 3 months ago

Hey, I have been trying to add a custom font to the generated PDF. But it seems like not working.

I downloaded the font and passed it to the CSS as a base64 string. It didn't work. @font-face { font-family: 'Poppins'; src: url('data:font/truetype;charset=utf-8;base64,{{fontPopins}}'); font-weight: normal; font-style: normal;

    }

Then I tried to load directly from the local file, but it also didn't work. { font-family: 'Poppins'; src: url('./Poppins-Regular.ttf') format('truetype');; font-weight: normal; font-style: normal; } Kindly let me know what I'm doing wrong