对于我在 javascript 中使用 pdfmake 即时提供报价和发票 pdf 的项目。我面临的问题是文本块在中间离开页面。我想要的是检查某个文本块或表格是否将在页面之间拆分,如果是,则在块之前添加分页符以确保文本或表格将完全在一页上。
我的 pdf docDefinition 是这样构建的:
return {
content: [
getOfferLogo(), //Get the logo or empty string
getHeading(), //get the customer and business data (adress etc)
//the above is always the same
getText(), //get the textblock, created by user and always different
getSpecifics(), //get a table of payment specifications
getSignature() //get last textblock contaning signature fields etc, always the same
],
styles: {
subheader: {
fontSize: 15,
bold: true,
alignment: 'center'
}
},
defaultStyle: {
columnGap: 20,
fontSize: 12
}
};
所以简而言之,我如何在创建pdf之前检查文本是否会离开页面并相应地添加分页符?
提前致谢。