如何在pdfmake中创建表页脚

时间:2018-03-20 14:14:04

标签: html angular pdf pdfmake

有没有办法在pdfMake中创建表格页脚?我有一张大桌子,只适合多页。我想在每页上重复表格页脚。

3 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

将此添加到您的文档中

footer: {
    columns: [ 
        '',
        { 
            alignment: 'right',
            text: 'Footer text'
        }
    ],
    margin: [10, 0]
}

答案 2 :(得分:0)

我终于弄清楚了该怎么做。 (1.)将当前的“ headerRows”计数增加1。 (2.)将页脚行放在标题行和数据行之间。 (3.)将页脚行的marginTop设置为略小于页面的高度。 (4.)将页脚行的marginBottom设置为((marginTop +行高)* -1)。

这会将表格页脚推到表格空间的外面,进入页面的页脚空间。

示例:

table: { headerRows: 2, widths: [700], body: [
  [{ text: 'My Header' }],
  [{ marginTop: 480, marginBottom: -490, text: 'My Footer' }], //480 roughly fits Landscape-Letter
  [{ text: 'My Data Row 1' }],
  [{ text: 'My Data Row 2' }],
  // more data rows
  [{ text: 'My Data Row N' }]
]}