0

I'm using Phantomjs 2.1.1 on ubuntu 16.04 to generate PDF files out of HTML (an NPM package called node-html-pdf). My problem is that Chinese charecters do not show up at all in the output PDF, whereas everything else is fine. Locally, on my Mac, the same HTML is generate fine (Chinese is shown fine). I've tried installing language packages like this:

sudo apt-get install language-pack-zh-hans
sudo apt-get install ttf-arphic-uming
sudo apt-get install ttf-dejavu ttf-wqy-microhei
sudo fc-cache -f -v

Also tried including Content-Type: text/html; charset=utf-8 in the HTML. Is there anything else I can try ?

2 Answers2

1

Most of the fonts are by default installed in MAC but not present on open source OS like Ubuntu. I was facing the same issue. It got resolved when I installed those.

Just try sudo apt-get install fonts-wqy-zenhei. It should work.

Ro Han
  • 11
  • 1
  • 1
  • This worked for me - I was trying to get Chinese characters to render using the Highcharts Export Server, and this fixed the problem. Thank you! – Witt Apr 14 '21 at 18:15
0

Sounds like you have this on a server, and you do not have the necessary fonts there. However on your mac you probably have the fonts. I would try adding more fonts to your server, and see if this fixes your issue.

https://github.com/m13253/kaigen-fonts

Might help.

NiteRain
  • 663
  • 8
  • 14