jspdf convert html to pdf with multiple pages
16,761
Another Solution.
var pdf = new jsPDF('p', 'pt', 'a4');
var options = {
pagesplit: true
};
pdf.addHTML($(".pdf-wrapper"), options, function()
{
pdf.save("test.pdf");
});
Source : jsPDF multi page PDF with HTML renderrer
another answer : jsPDF multi page PDF with HTML renderrer
Author by
matts1189
Updated on June 13, 2022Comments
-
matts1189 almost 2 years
I'm using jsPdf and html2pdf to convert html to a pdf file.
I can convert the html fine and download the file but if the html is too big to fit onto a single page, it does not create the other page(s), how do I do this?
code is:
var pdf = new jsPDF('l', 'pt', 'a4'); pdf.canvas.height = 72 * 11; pdf.canvas.width = 72 * 8.5; html2pdf(document.getElementById(id), pdf, function(pdf){ pdf.save('file.pdf'); });