Technique for finding invalid bookmarks in a PDF file
I have been encountering invalid bookmarks on a regular basis within PDF files lately. I went looking for a technique that would allow me to quickly determine if there were any broken bookmarks in a PDF file.
The solution I came up with involves using pdftk [https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/] and your favorite MAC or Linux command line:
pdftk mypdf.pdf dump_data | grep -B 2 "PageNumber: 0"
BookmarkTitle: 10.2 Oxygen equipment BookmarkLevel: 3 BookmarkPageNumber: 0 -- BookmarkTitle: 10.2.1 Chemical oxygen system: BookmarkLevel: 4 BookmarkPageNumber: 0