且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在JSPDF中防止表格在多个页面上分裂

更新时间:2023-12-01 22:49:52

您必须在添加新内容之前始终检查实际页面大小

you have to check the actual page size always before adding new content

doc = new jsPdf();
...
pageHeight= doc.internal.pageSize.height;

// Before adding new content
y = 500 // Height position of new content
if (y >= pageHeight)
{
  doc.addPage();
  y = 0 // Restart height position
}
doc.text(x, y, "value");

来源: MrRio/jsPDF/issues/101