jspdf convert html to pdf code example

Example 1: html to pdf javascript

var doc = new jsPDF();          
var elementHandler = {
  '#ignorePDF': function (element, renderer) {
    return true;
  }
};
var source = window.document.getElementsByTagName("body")[0];
doc.fromHTML(
    source,
    15,
    15,
    {
      'width': 180,'elementHandlers': elementHandler
    });

doc.output("dataurlnewwindow");

Example 2: html content in jspdf

var doc = new jsPDF();
$('#generatereport').click(function() {
   doc.fromHTML($('#lppresults')[0], 15, 15, {
      width: 170
   }, function() {
      doc.save('sample-file.pdf');
   });
});

Example 3: html to pdf

html2pdf.com is a great resource, web-based converter, super simple to use also.

Example 4: html to pdf

<!--why not try -->
<!--
HiQPdf Software
-->