Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const html_source = document.getElementById('contentID'); // Get html
- html2canvas(html_source).then(function(canvas) { // Convert to canvas
- let imgData = canvas.toDataURL('image/png'); // Generates image that you can store
- let pdf = new jsPDF('p', 'mm', 'a4'); //Create PDF, Note that you use the same image to create the PDF
- pdf.addImage(imgData, 'PNG', 10, 10);
- pdf.save('test.pdf');
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement