问题
I am using jspdf for generating my pdf report. I have multiple tables which show the principle, but when I am generating the pdf, table's rows are splitting between different pages, the upper row in initial page and later in later page.
I want the full table in a single page if there is no enough space in one page move the whole table in next page.
回答1:
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");
Source: MrRio/jsPDF/issues/101
来源:https://stackoverflow.com/questions/35179026/how-to-prevent-spliting-of-table-over-mutliple-pages-in-jspdf