在jspdf examples page之后,我尝试在jsfiddle中重现 addHTML 演示,但iframe-pdf保持为空。检查它会显示一个空的iframe,就像在jspdf演示页面中iframe填充嵌入对象一样。
var pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML($('#content')[0], function () {
var string = pdf.output('datauristring');
$('#preview-pane').attr('src', string);
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://html2canvas.hertzen.com/build/html2canvas.js"></script>
<script src="https://cdn.rawgit.com/MrRio/jsPDF/master/dist/jspdf.debug.js"></script>
<div id="content">
<h2>Have a play.</h2>
<p>A HTML5 client-side solution for generating PDFs. Perfect for event tickets, reports, certificates, you name it!</p>
<p><b>No servers were used in the making of this demo.</b>
</p>
</div>
<iframe id="preview-pane" type="application/pdf" width="100%" height="300" src=""></iframe>
&#13;
我在这里缺少什么?