2

I'm trying to export a PDF of a scanned book. Regardless of whether I try to use GIMP or LibreOffice Draw, I can't seem to name any of the cover pages! I want to have the page numbers on the exported PDF match the page numbers in the lower-right corner of the document, but I can't figure out how to make either program do this, nor do I know which one to use if neither is capable of this.

There's a front cover, a back cover, and each cover has something printed on its inside. I want to give these 4 pages special names to keep the numbering for the actual book content accurate. How do I accomplish this?

VHS
  • 151
  • 5
  • export to what format? – idiotprogrammer Jun 08 '22 at 21:33
  • To PDF. I have scanned pages in .png format, and I'm trying to reassemble them into a PDF for digital distribution. I'd like the cover pages to not mess up the numbering for the content pages. – VHS Jun 08 '22 at 23:57

1 Answers1

3

Okay, so I found a few answers elsewhere on Stack Overflow that answers my question. Very few programs can perform this process on a PDF, so you'll need to do it by hand in a plain-text editor that can handle files tens of megabytes large and won't choke on or corrupt the binary data in the embedded images. I used vim for this.

Search for the string Catalog in the PDF, then in the opening double angle brackets << add the following:

/PageLabels << /Nums [
0 << /P (Front Cover) >>
1 << /P (Front Cover, Inner) >>
2 << /S /D >>
26 << /P (Back Cover, Inner) >>
27 << /P (Back Cover) >>
] >>

Making the relevant changes for your PDF. These were just the particular page numbers and options relevant to me. The first number is the page number, starting from 0. The /P says that I want the text in parentheses to be the page title. The /S /D says that I want to start the numbering in Arabic numerals with page 1 being the third page of the PDF. There are a lot of options to use here. More information about this process and the available options can be found at these links:

https://askubuntu.com/a/347338

https://superuser.com/questions/232553/how-to-change-internal-page-numbers-in-the-meta-data-of-a-pdf

https://www.w3.org/TR/WCAG20-TECHS/PDF17.html#PDF17-ex2

https://newbedev.com/renumber-pages-of-a-pdf

VHS
  • 151
  • 5