How to change (offset) pagination in PDF

I use pdftk to execute a large number of scripts using pdf, but I am open to everything that can be done programmatically in linux, ideally via the command line or the python API.

I will need to change the pagination in pdf, i.e. make it start, for example, on page 5, and not 1. The main reason I need an offset is to combine this document with others, and ideally I would like each of the documents to have its own bookmarks and introduced them into the merger.

If I can't do this, one alternative is to cut out the bookmarks (using pdftk dump_data) from the document, turn them into a python object, and then collect the bookmarks by switching the page. This is not painless + there is a risk that I will change the source documents in unintended ways.

FWIW I tried to execute update_info with pdftk, after you changed the result with dump_data. It worked great for bookmarks, but changing page numbers (like in PageMediaNumber) didn't work at all.

Any suggestions?

+6
source share

Source: https://habr.com/ru/post/949121/


All Articles