使用jsPDF,目前正在尝试执行以下操作:
- Generate PDF document with "Hello world" string
- Download PDF document
<html>
<head>
<title>Page Title</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//mrrio.github.io/jsPDF/dist/jspdf.debug.js"></script>
</head>
<body>
<script>
function downloadPDF() {
var doc = new jsPDF('p', 'in', 'letter');
doc.text('Hello world', 10, 10);
doc.save('myPDF');
}
</script>
<button onclick="downloadPDF()" class="button">Run Code</button>
</body>
</html>
但是PDF文档最终证明是空的。
有什么想法吗?
发布于 2015-09-08 19:43:03
您要传递给jsPDF构造函数的参数是什么?移除它们对我有用:
var doc = new jsPDF();工作示例:http://output.jsbin.com/kaxafuwiri
https://stackoverflow.com/questions/32465777
复制相似问题