This is how I currently edit PDF bookmarks:
$ pdftk "$pdf_file" dump_data > /tmp/bookmarks.txt
$ emacs !$&
$ pdftk "$pdf_file" update_info /tmp/bookmarks.txt output new.pdf
$ mv new.pdf "$pdf_file"
It’s only great in some situations. It’s not great if there are no pre-existing bookmarks because there is no structure to edit. I then have to find another PDF that has bookmarks, then copy the structure into the metadata dump of the PDF that needs bookmarks, and edit that hoping that I made no mistakes. A sample of the metadata looks like this:
PDF bookmark metadata
BookmarkBegin
BookmarkTitle: CHAPTER I: GENERAL PROVISIONS
BookmarkLevel: 1
BookmarkPageNumber: 9
BookmarkBegin
BookmarkTitle: Article 1: Subject matter and objectives
BookmarkLevel: 2
BookmarkPageNumber: 9
BookmarkBegin
BookmarkTitle: Article 2: Scope
BookmarkLevel: 2
BookmarkPageNumber: 9
BookmarkBegin
BookmarkTitle: Article 3: Definitions
BookmarkLevel: 2
BookmarkPageNumber: 10
…
PageMediaBegin
PageMediaNumber: 1
PageMediaRotation: 0
Notice there is no “BookmarkEnd” lines in this, so the structure is not exactly intuitive. It’s prone to human error.
Is there a simpler tool for making minor additions? Evince is purely a viewer.
Okular has an “add bookmark” feature but it uses bookmark to mean something else. What other tools call bookmarks is called “Contents” in Okular. On the Contents sidebar you can right-click and “add bookmark” but that does not change the table of contents. Instead, that creates a reference/hook in another tab called “Bookmarks”. Okular’s nomenclature is more true to the intuitive meaning people expect, but it deviates from PDF norms. Anyway, Okular cannot handle the job.
