Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #26924


    I am merging existing pdf with another stream, i am able to get the pdf file, but i have an requirement where i need to include total number of pages at the end of generated pdf.
    How can i get the size(no.of Pages) of an existing pdf file.

    I have tried using “${total}” but this just gives the only the size of generated stream and does not include the size of existing pdf file that is merged with.

    Could any one of you please give the solution .. and we are using version: PD4ML 381 Pro

    Thanks in advance


    If you know a number of pages of the existent PDF, you may add it as a correction to the final $[total] value with header.setInitialPageNumber():

    [language=java:84n7vipe]PD4PageMark header = new PD4PageMark();
    header.setAreaHeight( -1 ); // autocompute
    header.setHtmlTemplate( “$[total]

    ” );
    pd4ml.setPageHeader( header );[/language:84n7vipe]

    If a number of pages is not known for a particular case, you would need to count it with a third-party tool. Currently PD4ML Web implements the needed PDF page count functionality ( ), but the API is not exposed and documented yet.

    We plan to include the new PDF manipulation module (PDF analyze, merge etc) to the main branch of PD4ML with a forthcoming release.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.