【发布时间】:2014-11-14 18:40:10
【问题描述】:
我正在使用 jspdf.debug.js 从网站导出不同的数据,但有一些问题,我无法让它在导出的 PDF 中呈现 CSS,如果我在页面中有图像,我就是导出时,PDF 返回空白...
有人知道解决这个问题的方法吗?
这是一个jsfiddle,显示它没有呈现 CSS
还有我的脚本
$(document).ready(function() {
$('#export').click(function(){
var d = new Date().toISOString().slice(0, 19).replace(/-/g, ""),
filename = 'financiar_' + d + '.pdf',
pdf = new jsPDF('p', 'pt', 'letter'),
specialElementHandlers = {
'#editor': function( element, renderer ) {
return true;
}
};
pdf.fromHTML(
$('.export').get(0) // HTML element
, 25 // x coord
, 25 // y coord
, {
'width': 550 // was 7.5, max width of content on PDF
, elementHandlers: specialElementHandlers
}
);
pdf.save( filename );
})
});
【问题讨论】:
-
github 问题在这里有一些建议github.com/MrRio/jsPDF/issues/91
标签: jquery css rendering jspdf