我也遇到过这个问题,不幸的是我没有作者来指导我,我的糟糕是我不知道stackoverflow返回他们。为了达到预期的效果,我不得不去编辑库。
我必须对printRows() 方法进行更改并进行检查以检查第一页和我需要表格开始的其余页面。因为第一页会有额外的图表边距。
我在 table.rows.forEach() 的第一个 if 条件中使用了以下内容,它检查 isNewPage() 方法:
if (pageCount == 1) {
doc.setDrawColor(228, 228, 228);
doc.rect(settings.margin.left, settings.startY + table.headerRow.height, table.width, row_height);
} else {
doc.setDrawColor(228, 228, 228);
doc.rect(settings.margin.left, settings.margin.top + table.headerRow.height + 30, table.width, row_height);
}
addPage();
这些是我使用的检查,并且特定于我的应用程序,看看您是否可以了解如何自行实施其余的检查。