Javascript Jspdf不生成任何pdf?

Javascript Jspdf不生成任何pdf?,javascript,php,pdf,jspdf,Javascript,Php,Pdf,Jspdf,我花了一天的时间在这里阅读关于jspdf的q/a,我尝试了一些例子。但是我仍然不能生成pdf。我不需要任何特殊的东西,没有图像,没有链接,只有纯文本。但是生成pdf按钮什么都做不了。现在我使用的代码是正确的版本 编辑:这是代码 谢谢那么问题是什么,您似乎也不确定?我想知道使用该代码可能会有什么问题..没有给出错误,只是“创建pdf”按钮没有任何作用..您能给我们显示代码吗?当你不知道的时候很难帮上忙,因为我们不知道…我更幸运的使用了AddHTML插件而不是FromHTML插件。你可以试试看。

我花了一天的时间在这里阅读关于jspdf的q/a,我尝试了一些例子。但是我仍然不能生成pdf。我不需要任何特殊的东西,没有图像,没有链接,只有纯文本。但是生成pdf按钮什么都做不了。现在我使用的代码是正确的版本

编辑:这是代码


谢谢

那么问题是什么,您似乎也不确定?我想知道使用该代码可能会有什么问题..没有给出错误,只是“创建pdf”按钮没有任何作用..您能给我们显示代码吗?当你不知道的时候很难帮上忙,因为我们不知道…我更幸运的使用了AddHTML插件而不是FromHTML插件。你可以试试看。 <!DOCTYPE html> <html lang="en"> <head> <title>html2canvas example</title> <script type="text/javascript" src="js/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/jquery/jquery-ui-1.8.17.custom.min.js"></script> <script type="text/javascript" src="js/jspdf.js"></script> <script type="text/javascript" src="libs/Deflate/adler32cs.js"></script> <script type="text/javascript" src="libs/FileSaver.js/FileSaver.js"></script> <script type="text/javascript" src="libs/Blob.js/BlobBuilder.js"></script> <script type="text/javascript" src="js/jspdf.plugin.addimage.js"></script> <script type="text/javascript" src="js/jspdf.plugin.standard_fonts_metrics.js"></script> <script type="text/javascript" src="js/jspdf.plugin.split_text_to_size.js"></script> <script type="text/javascript" src="js/jspdf.plugin.from_html.js"></script> <script type="text/javascript" src="js/basic.js"></script> <script type="text/javascript"> $(document).ready(function(){ var specialElementHandlers = { '#editor': function (element,renderer) { return true; } }; $('#cmd').click(function () { var doc = new jsPDF(); doc.fromHTML($('#target').html(), 15, 15, { 'width': 170,'elementHandlers': specialElementHandlers }); doc.save('sample-file.pdf'); }); }); </script> </head> <body id="target"> <div id="content"> <h3>Hello, this is a H3 tag</h3> <a class="upload" >Upload to Imgur</a> <h2>this is <b>bold</b> <span style="color:red">red</span></h2> <p> Feedback form with screenshot This script allows you to create feedback forms which include a screenshot, created on the clients browser, along with the form. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page. How does it work? The script is based on the html2canvas library, which renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements. This script adds the options for the user to draw elements on top of that image, such as mark points of interest on the image along with the feedback they send. It does not require any rendering from the server, as the whole image is created on the clients browser. No plugins, no flash, no interaction needed from the server, just pure JavaScript! Browser compatibility Firefox 3.5+ Newer versions of Google Chrome, Safari & Opera IE9 </p> </div> <button id="cmd">generate PDF</button> </body> </html>