jsPDF 将 html 转换为 pdf:utf-8 仅适用于文本,但不适用于 html

jsPDF convert html to pdf: utf-8 works only with text, but not html

我需要使用 jsPDF 将 html 转换为 pdf。 它包含 UTF-8 符号(西里尔文)。 我使用 fontconverter 为我的自定义字体生成 js 文件,如下所示: https://github.com/MrRio/jsPDF

所以现在带有文本的示例非常有用。

var pdf = new jsPDF('p', 'pt', 'letter');
doc.setFont('PTSans');
doc.setFontSize(10);
doc.text("А ну чики брики и в дамки!", 10, 10);

带有 html 的示例会忽略我的自定义字体并导出不正确的符号。

var pdf = new jsPDF('p', 'pt', 'letter');
doc.setFont('PTSans');
doc.setFontSize(10);
pdf.html( "<html>А ну чики брики и в дамки!</html>", { callback: function (pdf) {
    var iframe = document.createElement('iframe');
    iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
    document.body.appendChild(iframe);
    iframe.src = pdf.output('datauristring');
    }
});

我需要做什么才能将 html 导出为带有 unicode 符号的 pdf?

我还没有找到解决这个问题的方法,并在 jspdf 上创建了问题 github。 而且我发现 pdfmake.org 可以正确处理 utf-8 符号,所以如果你有同样的问题,请使用 pdfmake。