Javascript JSPDF未在网页中生成图像

Javascript JSPDF未在网页中生成图像,javascript,jquery,html,jspdf,Javascript,Jquery,Html,Jspdf,我想创建生成网页到pdf。在我的网站上,, 这个脚本是工作,但不是在我的网站生成图像 您可以在此链接中下载我的脚本> 您可以在文件“test.html”中进行测试 在询问之前,我已经尝试在谷歌搜索,但没有找到关于这个案件。 请帮帮我。这是我的剧本 <!DOCTYPE html> <html lang="en"> <head> <title>Testing</title> <script type="text/ja

我想创建生成网页到pdf。在我的网站上,, 这个脚本是工作,但不是在我的网站生成图像

您可以在此链接中下载我的脚本> 您可以在文件“test.html”中进行测试

在询问之前,我已经尝试在谷歌搜索,但没有找到关于这个案件。 请帮帮我。这是我的剧本

 <!DOCTYPE html>
<html lang="en">
<head>
    <title>Testing</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="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="jspdf.plugin.addimage.js"></script>
    <script type="text/javascript" src="jspdf.plugin.standard_fonts_metrics.js"></script>
    <script type="text/javascript" src="jspdf.plugin.split_text_to_size.js"></script>
    <script type="text/javascript" src="jspdf.plugin.from_html.js"></script>
  <script type="text/javascript">
  $(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('try.pdf');
    });  
});


  </script>
</head>
<body >
<div id="target">    
    <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.<br/>
     <img src="http://cdnstatic-2.mydestination.com/library/images/481030_1680_948.jpg" width="200px" height="100px">
      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>

测试
$(函数(){
变量specialElementHandlers={
“#编辑器”:函数(元素、渲染器){
返回true;
}
};
$('#cmd')。单击(函数(){
var doc=new jsPDF();
doc.fromHTML($('#target').html(),15,15{
“宽度”:170,“元素处理程序”:SpecialElementHandler
});
doc.save('try.pdf');
});  
});
带有屏幕截图的反馈表单此脚本允许您创建包含屏幕截图的反馈表单,
与表单一起在客户端浏览器上创建。
屏幕截图是基于DOM的,因此可能无法100%准确地反映真实情况
表示,因为它不生成实际的屏幕截图,而是基于
页面上提供的信息。它是如何工作的?该脚本基于html2canvas库,
它通过读取DOM和应用的不同样式,将当前页面呈现为画布图像
与元素相关。此脚本为用户添加了在该图像上绘制元素的选项,
例如,在图像上标记感兴趣的点以及它们发送的反馈。
它不需要从服务器进行任何渲染,因为整个图像是在客户端浏览器上创建的。 没有插件,没有flash,服务器不需要交互,只有纯JavaScript!浏览器兼容性Firefox 3.5+谷歌Chrome、Safari和Opera IE9的更新版本

生成PDF
HTML/网页视图

PDF视图
有一天可能有人会需要这个;图像必须转换为base64。

?您不能使用服务器端解决方案吗?我曾经使用并喜欢hmmm。我稍后会尝试,在这个案例之后,通常最好提供一个示例来演示您的解决方案。