How to get page count from PdfDocument

Posted by: curiosichi on 15 July 2019, 9:55 pm EST

    • Post Options:
    • Link

    Posted 15 July 2019, 9:55 pm EST

    const doc = new wijmoPDF.PdfDocument
    

    When creating a pdf document, I found you can format the document to include a page count on the footer of the pages, but how do I store that information, or query a property of the PdfDocument to get a page count for a summary output on my angular component.

    I’d like something similar to:

    doc.getPageCount()
    
  • Posted 16 July 2019, 1:00 am EST

    Hi,

    To add page numbers to the footer of PDF document, you may use the &[Page] and &[Pages] directive. The value of &[Page] is the current page number and &[Pages] is the total number of pages in the document. Please refer to the code snippet below:

    var doc = new wjcPdf.PdfDocument({
          footer: {
            declarative: {
              text: '\t&[Page]\\&[Pages]'
            }
          }
    });
    

    You may also use the pageIndex property of PdfDocument class to get the current page index.

    You may also refer to the sample below:

    https://stackblitz.com/edit/angular-yekajz

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels