我正在尝试让 jspdf 工作。单击我的 fiddle 中的按钮后什么也没有发生。这是jsfiddle (https://jsfiddle.net/light22/68h81owf/)。预先感谢您对我的帮助。
这是我正在使用的脚本:
<script>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
source = $('#for_pdf')[0];
specialElementHandlers = {
'#bypassme': function (element, renderer) {
return true
}
};
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
pdf.fromHTML(
source,
margins.left,
margins.top, {
'width': margins.width,
'elementHandlers': specialElementHandlers
},
function (dispose) {
pdf.save('download.pdf');
}, margins
);
}
</script>
最佳答案
点击 jsfiddle 中的按钮后,抛出错误:ReferenceError: demoFromHTML is not defined
。您还忘记关闭<table>
中的样式属性
关于javascript - 需要帮助让 jspdf 将 html 渲染为 PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42549436/