Thai font not displaying on pdf (using invoiceninja.com)

My customers are Thai and the names, addresses and product names are in Thai. However there isn’t any font available that can display Thai characters. They either completely disappear, or become little squares. Anything I can do to change this?

There’s an open issue on the github page for Thai language support in invoices/quotes.

Long story short, the included fonts for PDF generation don’t properly support Thai script. So a font like Mitr, Sukunvit, or Niramit would need to be included so that you could generate invoices with Thai characters. I’ve tried manually adding fonts (including editing my database to ensure the font is selectable), but never managed to get it to actually work.

I did a search on this and it looks like this issue has been an issue for quite some time now. I’d better look for another solution then.

After some more tinkering, I can get the font itself to show up just fine, but it never works in previews. My best guess is it’s a limitation with PhantomJS (which is used to generate the PDF files). So it doesn’t appear to be an issue with Invoice Ninja, so much as that third-party utility.

That being said, if I recall correctly, the next version of Invoice Ninja will be doing away with PhantomJS, and is an almost total re-write. Could definitely be worth checking out once that hits release status.

Whoever googled problem about thai font and end up here, you can use font “Sarabun” (https://fonts.google.com/specimen/Sarabun) and follow custom font instruction (https://invoice-ninja.readthedocs.io/en/latest/configure.html)

I’ve tested with v4.5.34, work like a charm!!

1 Like