IMGKit icon indicating copy to clipboard operation
IMGKit copied to clipboard

Issues with fonts when trying to convert html to image using imgkit and wkhtmltoimage

Open ankush86 opened this issue 9 years ago • 4 comments

Trying to convert the HTML content into image using ImgKit and wkhtmltoimage. Image is converted successfully but facing the issues with fonts (Font Awesome).

The image is not look as it as HTML content.

Attaching 2 images one which have HTML content (HTML-CONTENT.png) and other one is converted to image (HTML-Converted-To-IMAGE.png). You can see the difference in fonts between the 2 images.

html-content

html-converted-to-image

Could you please anyone suggest me on this, how can I achieve exact html conversion into image.

Thanks for the help in advance.

ankush86 avatar May 20 '16 09:05 ankush86

You're definitely right that wkhtmltoimage doesn't seem to be picking up your fonts. To troubleshoot I'd recommend you try using wkhtmtoimage outside of IMGKit with a small html file that just imports your fonts.

Here's a stack overflow article on getting fonts working with wkhtmltopdf: http://stackoverflow.com/questions/10611828/use-custom-fonts-with-wkhtmltopdf

csquared avatar Jun 08 '16 14:06 csquared

You can download the required ttf file and use it in your css, This will work, Anyway sorry for the late support! :-)

Magesh-B avatar May 04 '20 14:05 Magesh-B

@Magesh-B If you have any example can you please share it. I have html file in which I had included custom fonts from assets, while I am trying to convert html file to image I am facing issue for fonts.

riddhibacancy avatar Jul 21 '20 15:07 riddhibacancy

@csquared , Hey there, Your lib is absolutely fantastic made my work so easy except one stage. I am not able to get the set font family in the final image result. If you could help me out it would be really great help to me.

nikhil-bacancy avatar Jul 23 '20 13:07 nikhil-bacancy