Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wkhtmltopdf amazon linux won't encode emoji

I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box. Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:

Local (Ubuntu): Local Image

Production (Amazon Linux): Production Image

As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:

/my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'

Thanks for your time.

like image 347
Gumma Mocciaro Avatar asked Oct 22 '25 03:10

Gumma Mocciaro


1 Answers

You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.

like image 133
panza Avatar answered Oct 24 '25 12:10

panza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!