使用pdfmake将文本固定到pdf的最后一页底部

Fix text to bottom of last page in pdf using pdfmake

本文关键字:pdf 最后 一页 底部 pdfmake 文本 使用      更新时间:2023-09-26

对于一个项目,我正在使用javascript中的pdfmake动态提供报价和发票pdf。我想将包含签名字段的最后一个文本块附加到最后一页的底部。

我的pdf文档定义是这样构建的:

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
                }
            };

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

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