SGMLXML.net A place for SGML and XML application developers.

September 24, 2014

Technique for finding invalid bookmarks in a PDF file

Filed under: Software — cangione @ 3:42 pm

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"

Results:

BookmarkTitle: 10.2 Oxygen equipment
BookmarkLevel: 3
BookmarkPageNumber: 0
--
BookmarkTitle: 10.2.1 Chemical oxygen system:
BookmarkLevel: 4
BookmarkPageNumber: 0

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress