I have a pdf document I created through non-Acrobat means (printing to pdf, then merging a bunch of pdfs), but I'd like to manually change the page numbers (i.e. the first several pages are simply title pages, the page that is labeled "page 1" is really the 7th sheet of the pdf). What's the simplest (and ideally, free) way to do this?
To be clear, I am not trying to change the numbers on the pages themselves, but the page numbers in the "metadata" that the pdf stores (the pages themselves are already numbered correctly; I just want "go to page 1" to go to the page labeled 1, which could be sheet 7).
For what it's worth, I'm on Windows, though I have access to Macs as well.
Best Answer
What you want is indeed called page labels and can easily be added directly in the PDF's source code. Rename the file extension from
pdf
totxt
and open the file in a text editor (this can be slow, depending on the file size, be patient). The information about page labels is stored in a node called the document catalog which looks something like this:It may contain more confusing stuff, but this is the basic structure. There is only one catalog, so in a large file you can search for the node that contains
/Catalog
. Now you can make your desired changes by inserting the/PageLabels
entry:There are 3 lines starting with numbers, called page indices. Page 1 has the index
0
, page 2 the index1
and so forth. They always describe ranges, so the line with1 <<...>>
applies to all pages from index 1 to 5 and the line with6 <<...>>
applies to all pages from 6 up to the last page. A label for0 <<...>>
must always be defined.You can find more information about page labels and PDF source code in the PDF standard or in a wiki on PDF standards.