Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
(function(){
var form = $('.form');
$('#create_pdf').on('click',function(){
$('body').scrollTop(0);
createPDF();
});

//create pdf
function createPDF(){
getCanvas().then(function(canvas){
var img = canvas.toDataURL("image/jpeg"),
doc = new jsPDF({
unit:'px',
format:'a4'
});
doc.addImage(img, 'JPEG', 20, 20);
doc.save('techumber-html-to-pdf.pdf');
});
}

// create canvas object
function getCanvas(){
return html2canvas(form,{
imageTimeout:2000,
removeContainer:true
});
}
}());

What I have tried:

We want to convert a web page as it is to a PDF including all styles, Alignments. By using above code we are able to download a web page as a pdf in all browsers(Chrome, Firefox, IE-10,11) except IE9. we have used JSPDF v1.2.6 plugin.
Posted
Updated 26-Aug-16 3:34am

1 solution

According to the site[^], IE6-9 requires a Flash shim to work. The current build does not have that shim enabled.

There are a couple of issues on the GitHub repository discussing this, but no definitive answer:


The GitHub repository is the best place to discuss this issue, since the developer is probably the only person who could tell you how to get the code working in IE9.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900