0

I am using JSPDF library to generate pdf while working on korean language the letters are getting change in symbols and sometime empty. Could anyone please help me?

const doc = new jsPDF();

const myFont = ... // overhere i am inserting a string which is being generated using following link https://rawgit.com/MrRio/jsPDF/master/fontconverter/fontconverter.html(it's too long)

// add the font to jsPDF

doc.addFileToVFS("MyFont.ttf", myFont);
doc.addFont("MyFont.ttf", "MyFont", "normal");
doc.setFont("MyFont");
Omer
  • 13
  • 4
  • 1
    Does your font contains glyphs for Korean language? What encoding you set for your PDF? – Justinas Oct 26 '21 at 09:35
  • https://fonts.google.com/noto/specimen/Noto+Sans+KR?subset=korean I am using the following font. – Omer Oct 26 '21 at 09:57
  • Does this answer your question? [jsPDF - fromHTML and custom fonts](https://stackoverflow.com/questions/48279675/jspdf-fromhtml-and-custom-fonts) – Justinas Oct 26 '21 at 10:12
  • No i have tried it but no luck. – Omer Oct 26 '21 at 10:21
  • `const myFont = "APT/+AD0AAQACQAJAAQABADzAPMA9ADzAPMA9AD0AGcA/wD/AP8A/wD/AQAAAA=="; // add the font to jsPDF doc.addFileToVFS("NotoSansKR-Regular.ttf", myFont); doc.addFont("NotoSansKR-Regular.ttf", "NotoSansKR-Regular", "normal"); doc.setFont('NotoSansKR-Regular','normal');` – Omer Oct 26 '21 at 12:03

1 Answers1

0

You can try directly print the HTML text element.

Shameless plug : generate-pdf-from-react-html