2017-06-13 99 views
0

我正在使用jspdf.debug.js最新版本。 FontAwesome网页中使用的图标不在pdf中呈现。 我在页面中添加了一个FontAwesome用户图标。请参阅图像(左边一个是HTMLpdf输出在右边) 下面是我的代码片段。在jsPdf中添加FontAwesome图标

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'); 
}); 

enter image description here

回答