Note that there are some explanatory texts on larger screens.

plurals
  1. POExporting web page into PDF using jsPDf
    text
    copied!<p>I am trying to export the webpage into pdf file when user click the button, but the below code is not working for me . can any one please help me where I went wrong. I am using jsPDF to export the web page into pdf.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;html2canvas example&lt;/title&gt; &lt;script type="text/javascript" src="js/jquery/jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery/jquery-ui-1.8.17.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jspdf.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="libs/Deflate/adler32cs.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="libs/FileSaver.js/FileSaver.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="libs/Blob.js/BlobBuilder.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jspdf.plugin.addimage.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jspdf.plugin.standard_fonts_metrics.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jspdf.plugin.split_text_to_size.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jspdf.plugin.from_html.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/basic.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { var doc = new jsPDF(); var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#cmd').click(function () { doc.fromHTML($('#content').html(), 15, 15, { 'width': 170, 'elementHandlers': specialElementHandlers }); doc.save('sample-file.pdf'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body id="target" &gt; &lt;div id="content"&gt; &lt;h3&gt;Hello, this is a H3 tag&lt;/h3&gt; &lt;p&gt;a pararaph&lt;/p&gt; &lt;/div&gt; &lt;div id="editor"&gt;&lt;/div&gt; &lt;button id="cmd"&gt;generate PDF&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload