【发布时间】: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