How to change (offset) page numbering in PDF
Asked Answered
K

0

9

I have been using pdftk to do a lot of scripting with pdf, but I am open to anything that can be done programmatically in linux, ideally through command line or python API.

I would need to change the page numbering in a pdf, i.e. make it so that it starts say, on page 5 instead of 1. The main reason I need the offset is that I will merge this document with others, and ideally I would like each of the documents to carry their own bookmarks and contribute them in the merge.

If I can't do that, one alternative is to strip out the bookmarks (using pdftk dump_data) from the doc, turn them into a python object, then assemble the bookmarks by carrying out the page shifting myself. It's not painless + there's a risk that this I will alter the original documents in unintended ways.

FWIW I did try doing update_info with pdftk, after having tweaked with the output from dump_data. It worked fine for bookmarks, but changing page numbers (as in PageMediaNumber) did not work at all.

Any suggestions?

Keirakeiser answered 10/7, 2013 at 13:15 Comment(2)
possibly see the answers of this: askubuntu.com/questions/32048/renumber-pages-of-a-pdfWords
One possibility is to use pdftk uncompress to make the pdf editable in your text editor, then edit the page numbers, then use pdftk compress to restore it to PDF usability.Words

© 2022 - 2024 — McMap. All rights reserved.