I made a recursive function for generate a PDF iterating some divs. When there's no more divs, I save the PDF. I'm using html2canvas to catpure the HTML code of each div into a canvas and jsPDF to put the canvas as an image and generate the PDF. This code works well, except when the PDF exceeds 8MB, it stops adding content:
I want to know if jsPDF have a limit in size when generating PDF's.
var doc = new jsPDF(); appendDataToPDF(some_div, doc, 1); /* calling function below */ function appendDataToPDF(div, doc, top) { html2canvas(div, { onrendered: function(canvas) { var img = canvas.toDataURL(); doc.addImage(img, 'JPEG', 10, top, width, height); if(top > 200 /* some value to detect if limit of page reached */) { doc.addPage(); top = 1; } else top += 40; div = div.nextSibling; if(div === null) doc.save('Test.pdf'); else appendDataToPDF(div, doc, top); } }); }