Search code examples
batch-filesejda

Adding the total number of pages to the page number in Sejda


I'm using the sejda-console to add page numbers to a PDF and I would like to include the total number of pages. For example, if my PDF has 20 pages, I would like it to say "page 1 of 20" on the first page and so on.

How can I do this with sejda?


Solution

  • You can do that using Sejda 2.x, here's an example:

    ./bin/sejda-console setheaderfooter -f input.pdf -o /tmp/output.pdf --pageRange all --verticalAlign bottom --horizontalAlign center --label "Page [PAGE_OF_TOTAL]"
    

    There's no released 2.x version yet, so for the time being you'd need to build it from source:

    https://github.com/torakiki/sejda