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?
pdftk uncompress
to make the pdf editable in your text editor, then edit the page numbers, then usepdftk compress
to restore it to PDF usability. – Words