1

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?

08Dc91wk
  • 4,254
  • 8
  • 34
  • 67

1 Answers1

0

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

Edi
  • 621
  • 6
  • 17
  • Thanks for the fast reply :) I tried it the way you did but it just says "text [PAGE_OF_TOTAL]" in my PDF. I even redownloaded the Sejda 1.0.0 release from your link and it's still the same. Here is the line I'm using (sorry for the editing, i don't know how to do the code window ): sejda-console setheaderfooter -f %%K\m2.pdf -o %%K\m3.pdf -s all -t Helvetica -d 10 -l "Seite [PAGE_OF_TOTAL]" -y bottom -x left – Iknownothing Sep 07 '15 at 15:12
  • Think you're running an old Sejda version that doesn't support [PAGE_OF_TOTAL] placeholders. One of the first log outputs is the sejda version, could you confirm it's saying "Configuring Sejda 1.0.0.RELEASE"? – Edi Sep 07 '15 at 18:34
  • The first ouptput is: "09:22:05.312 Configuring Sejda 1.0.0.RELEASE 09:22:05.435 Loading Sejda configuration form default sejda.xml 09:22:06.323 Starting execution with arguments: '' 09:22:06.323 Java version: '1.8.0_60' 09:22:06.387 Sejda Console". – Iknownothing Sep 08 '15 at 07:25
  • You're right, I'm sorry. This feature is not in 1.0.0-RELEASE, only in the 2.x versions of Sejda. We haven't released any 2.x version that you can download and install yet, so you would need to build a sejda-console from source to use it right now. – Edi Sep 08 '15 at 11:59
  • As I am not good enough to build one on my own, I think I am going to wait for your 2.x version and leave it as a normal page number for now. Will it be possible to choose the language of [PAGE_OF_TOTAL], so for example "1 von 20" in german ? And I want to thank you for making sejda, it helped me alot so far :) – Iknownothing Sep 08 '15 at 12:18
  • Thanks for the suggestion, I've created https://github.com/torakiki/sejda/issues/187 for the internationalised [PAGE_OF_TOTAL] – Edi Sep 08 '15 at 15:46