【问题标题】:Korean language not rendering on PDF while using JSPDF使用 JSPDF 时韩语无法在 PDF 上呈现
【发布时间】:2021-12-11 16:22:18
【问题描述】:

我正在使用 JSPDF 库生成 pdf,同时使用韩语,这些字母的符号发生变化,有时是空的。谁能帮帮我?

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)

//给jsPDF添加字体

doc.addFileToVFS("MyFont.ttf", myFont);
doc.addFont("MyFont.ttf", "MyFont", "normal");
doc.setFont("MyFont");

【问题讨论】:

  • 您的字体是否包含韩语字形?您为 PDF 设置了什么编码?
  • 这能回答你的问题吗? jsPDF - fromHTML and custom fonts
  • 不,我试过但没有运气。
  • 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');

标签: javascript html angularjs pdf jspdf


【解决方案1】:

您可以尝试直接打印 HTML 文本元素。

无耻的塞?: generate-pdf-from-react-html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-29
    • 1970-01-01
    • 2014-11-14
    • 2021-02-05
    • 1970-01-01
    • 2017-04-01
    • 2021-06-20
    • 2017-07-21
    相关资源
    最近更新 更多