Reputation: 1215
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
:
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.
Upvotes: 4
Views: 1618
Reputation: 26
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.
Upvotes: 1
Reputation: 398
If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.
The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf
Hope this helps you forward.
EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font
Upvotes: 1