I was trying to generate PDF from HTML using jsPDF and html2canvas. It worked with full page, but not specific div using getElementById()
. The console says
IndexSizeError: Index or size is negative or greater than the allowed amount html2canvas.js:2859
Here's my script
<script>
let doc = new jsPDF();
doc.addHTML(document.getElementById('content'), function() {
doc.save('html.pdf');
});
</script>
can anyone help me with this?