简体   繁体   中英

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");
});

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

https://github.com/eKoopmans/html2pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM