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

时间:2015-11-30 10:40:29

标签: javascript pdf pdfmake

对于在javascript中使用pdfmake动态制作优惠和发票的项目。我想将包含签名字段的最后一个文本块附加到最后一页的底部。

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




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

1 个答案:

答案 0 :(得分:2)

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