Created
February 16, 2019 05:47
-
-
Save M-Abdullahi/51952366f4a1cbe7297287bfdd9faa5e to your computer and use it in GitHub Desktop.
Export html div content as image and save it to a pdf file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html2canvas($("#canvas"), { | |
onrendered: function(canvas) { | |
var imgData = canvas.toDataURL( | |
'image/png'); | |
var doc = new jsPDF('p', 'mm'); | |
doc.addImage(imgData, 'PNG', 10, 10); | |
doc.save('sample-file.pdf'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment