简体   繁体   English

在 jsPdf 中添加 FontAwesome 图标

[英]Add FontAwesome Icon in jsPdf

I am using jspdf.debug.js latest version.我正在使用jspdf.debug.js最新版本。 FontAwesome icons used in a web page are not rendering in pdf .网页中使用的FontAwesome图标不会以pdf呈现。 I added a FontAwesome user icon in the page.Refer to the image.(Left one is HTML and pdf output is on right) Below is my code snippet.我在页面中添加了一个FontAwesome用户图标。参考图片。(左边是HTML ,右边是pdf输出)下面是我的代码片段。

var pdf = new jsPDF('p', 'pt', 'letter');
pdf.addFont('FontAwesome', 'FontAwesome', 'normal');
pdf.setFont('FontAwesome');
pdf.canvas.height = 72 * 11;
pdf.canvas.width = 72 * 8.5;
html2pdf(document.body, pdf, 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');
});

在此处输入图像描述

jspdf does not support special symbols. jspdf 不支持特殊符号。 Here is the gitHub issue .这是gitHub 问题 See info in this answer .请参阅此答案中的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM