Add and edit bookmarks to a PDF file

It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:

You can now add or change a PDF’s bookmarks using update_info.

via: http://www.pdflabs.com/docs/pdftk-version-history/


If you still stick with those unix scripts, then

  1. extract bookmark data dumped from pdftk
  2. write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command gs is accepted.
  3. use gs script to merge them together with pdfmarks

Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.

pdf-merge.py --output=merged.pdf input1.pdf input2.pdf

Some minor improvements could be done in his script

  1. unicode handling
  2. output bookmark files, so people can adjust it as well

Anyway, it should work


pdftk is definetly the right tool (with the right syntax):

BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1

Tags:

Pdf

Pdftk