Pdfmake: Positioning the Content in Footer

Created on 14 Nov 2017  路  2Comments  路  Source: bpampuch/pdfmake

When i tried to display the footer with two contents(Confidential and Page Number) in a single row i will not able to achieve it.Any feature available in pdfmake to achieve it or is there any alternative solution.

Below is the snippet i tried in playground.

var dd = {
    pageSize: 'LEGAL',
    pageOrientation: 'landscape',
    pageMargins: [40, 80, 40, 60],
footer: function (currentPage, pageCount) {  
        var columns = [ {
            text: 'Confidential',
            width: 'auto',
            alignment: 'center',
          },
           {
            text:  'Page ' + pageCount,
            width: 'auto',
            alignment: 'right',
          }
          ]
        return columns;
      }, 
    content: [
        'Page Contents'      
    ]
}

Am i a doing anything wrong?

Most helpful comment

Solution like this:

var dd = {
    pageSize: 'LEGAL',
    pageOrientation: 'landscape',
    pageMargins: [40, 80, 40, 60],
    footer: function (currentPage, pageCount) {
        return {
            table: {
                widths: ['*', 100],
                body: [
                    [
                        {text: 'Confidential', alignment: 'center'},
                        {text: 'Page ' + pageCount, alignment: 'right'}
                    ]
                ]
            },
            layout: 'noBorders'
        };
    },
    content: [
        'Page Contents'
    ]
}

All 2 comments

Solution like this:

var dd = {
    pageSize: 'LEGAL',
    pageOrientation: 'landscape',
    pageMargins: [40, 80, 40, 60],
    footer: function (currentPage, pageCount) {
        return {
            table: {
                widths: ['*', 100],
                body: [
                    [
                        {text: 'Confidential', alignment: 'center'},
                        {text: 'Page ' + pageCount, alignment: 'right'}
                    ]
                ]
            },
            layout: 'noBorders'
        };
    },
    content: [
        'Page Contents'
    ]
}

=

Solution like this:

var dd = {
  pageSize: 'LEGAL',
  pageOrientation: 'landscape',
  pageMargins: [40, 80, 40, 60],
  footer: function (currentPage, pageCount) {
      return {
          table: {
              widths: ['*', 100],
              body: [
                  [
                      {text: 'Confidential', alignment: 'center'},
                      {text: 'Page ' + pageCount, alignment: 'right'}
                  ]
              ]
          },
          layout: 'noBorders'
      };
  },
  content: [
      'Page Contents'
  ]
}

Can I add dynamic content like this.customerName instead of Confidential in angular?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

einfallstoll picture einfallstoll  路  3Comments

dgrice picture dgrice  路  3Comments

sayjeyhi picture sayjeyhi  路  3Comments

ValeSauer picture ValeSauer  路  3Comments

qgliu picture qgliu  路  3Comments