edisonneza / jspdf-invoice-template

PDF template created to generate invoices based on props object. Using jsPDF library.

Home Page:https://edisonneza.github.io/jspdf-invoice-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Japanese language

adamfakrullah opened this issue · comments

Hi may I know this package can use Japanese language for pdf file such as for column. example quantity word to Japanese. Thank you

Hi @adamfakrullah,
Yes it should work. Just set the object parameters titles in your language.

image
Hi, i try change client name into Japanese language but it appear another word. U can refer the image

Got it. Will do some tests on it.

Thank you sir

Hi sir, do you have any update about this bug? Thank youu

I didn't have time to make some tests, but i think before this weekend

Oh okay. Hope you can help me. Please update once you already solved this bug. Thanks

I think I can't do anything about supporting Japanese language (or even Rusian), because in my tests with some words it does work, but with some others (as in the second image) it doesn't. Some chars are displayed, some others not.

image

image

I think I can't do anything about supporting Japanese language (or even Rusian), because in my tests with some words it does work, but with some others (as in the second image) it doesn't. Some chars are displayed, some others not.

image

image

this is a JSPDF related issue, for me (on arabic language) i had to test multiple fonts till finally one of them was capable of showing characters in correct format.

my advice would be to search in jspdf issues and see if someone has found a fully working font in there, or try to find one urself.

i hope that this was helpful

Can you please share the font you found that worked for you?
@Nabeeh-AlSawaf

Can you please share the font you found that worked for you? @Nabeeh-AlSawaf

first i tried the same amiri font that is used by jspdf team but downloaded it from google and that actually failed.
later i tried the exact same file from their repository not from google and it magically worked.

you can find all the fonts they used in this link:
https://github.com/parallax/jsPDF/tree/master/test/reference

direct link to amiri font : https://github.com/parallax/jsPDF/raw/master/test/reference/Amiri-Regular.ttf

For the Arabic language understood. Thanks!

Arabic language Didn't work ? Why
when data is Arabic it transform to þòþàþË

@adamfakrullah can u please make a test using this solution about JAPANESE language?
https://stackoverflow.com/questions/62772841/jspdf-not-supporting-japanese-language
if u find it easier use the jspdf library instead;

about ARABIC language please try this other example:
https://codesandbox.io/s/js-playground-forked-19t4vw?file=/src/index.js

please write feedback about them if they worked for any of you. Thanks!

for japanese language, this worked for me:

mapPdf.addFont("/NotoSansJP-Regular.ttf", "NotoSansJP-Regular", "regular");
mapPdf.setFont("NotoSansJP-Regular", "regular");
mapPdf.setFontSize(20);
mapPdf.text(text, textX, textY);

I was able to just put the downloaded ttf file in my public directory and access it from there. Might be better if I just add it to my s3 and fetch it when I need it, but it's all the same.

it is odd that I can't just set the font to what I want initially when I create mapPdf from new jsPDF() (unless I'm missing something?)