Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add page break using jspdf and html2canvas

I know this has been asked before but I can't seem to find the answer, how to add page break, my page cut if convert to pdf ..??

html2canvas(document.getElementById("content")).then(function (canvas) {
  var img = canvas.toDataURL("image/png");
  var doc = new jsPDF({
    orientation: "landscape",
    format: "a4",
  });
  doc.addImage(img, "JPEG", 1, 5);
  doc.save("testCanvas.pdf");
});
like image 284
Ahmad Sayadi Avatar asked Dec 14 '22 14:12

Ahmad Sayadi


1 Answers

For PDF conversion, use this library instead, it supports break pages :

https://github.com/eKoopmans/html2pdf

like image 180
Charlie Rabiller Avatar answered Dec 17 '22 22:12

Charlie Rabiller