使用 pdfmake 将文本修复到 pdf 中最后一页的底部

And*_*ool 2 javascript pdf pdfmake

对于一个项目,我使用 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
                }
            };
Run Code Online (Sandbox Code Playgroud)

如何将调用 getSignature() 获得的最后一个文本块附加到 pdf 最后一页的底部?

小智 5

var docDefinition = {
    content: content,
    footer: function(currentPage, pageCount) {                 
        if (currentPage == pageCount)
            return "Your footer goes here";
    },
}
Run Code Online (Sandbox Code Playgroud)