I am using pdftk
to rearrange pages of a pdf file with bookmarks/outlines, but after that, the output file lost the bookmarks of the original.
My command is pdftk in.pdf cat 1-22 43 23-42 44-end output out.pdf
.
I was wondering how I could keep the bookmarks while rearranging pages?
Best Answer
Here is a working solution. However you will need to adjust it to fit your needs.
In my example i removed the first page of a PDF, and then i needed to update the bookmarks to point to the correct locations.
remove page 1 from in.pdf:
create a in.info file from in.pdf:
in.info needs to be corrected in my case, since i will remove a page.
Thus, i need to decrease BookmarkPageNumber by one for the bookmarks to lead to the correct pages.
php code:
create final out.pdf:
tested working on debian using pdftk 2.01