vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
344 stars 44 forks source link

how to use a custom font? #100

Open danielmari2 opened 1 year ago

danielmari2 commented 1 year ago

I'm trying to using a custom font but I'm not able to do so. I tried with google fonts using and it works, but when I try to add my custom font from a local file with @face-font it doesn't work.

Can someone share the code?

BranislavBajuzik commented 1 year ago

You can work around this by embedding it as base64: https://codepen.io/netsi1964/pen/mLWoaE

A solution would be to make a mechanism to pass these files so they can also be copied to the temp folder (Or you can maybe try to set your folder as the tmp folder)

einzelfabrik commented 1 year ago

You can work around this by embedding it as base64: https://codepen.io/netsi1964/pen/mLWoaE

A solution would be to make a mechanism to pass these files so they can also be copied to the temp folder (Or you can maybe try to set your folder as the tmp folder)

I can confirm, have included it as base64 - and you get the correct font also in the screenshot.