I use jsPDF and html2Canvas to create a PDF.
It works if I am targeting document.body.
<script type="text/javascript">
function pdfDownload() {
var pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML(document.body, function () {
pdf.save('test.pdf');
});
}</script>
However, if I try to use id in the #pdfcontent div, I get:
"Unused error: the supplied data is not JPEG"
<script type="text/javascript">
function pdfDownload() {
var pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML($('#pdfcontent')[0], function () {
pdf.save('test.pdf');
});
}</script>
help me please
source
share