I was wondering how difficult it would be to write a script that would go through all my bookmarks in the current PDF and mark those bookmarks that are dead and don't lead anywhere in a specific manner? Maybe bold and in red font?
We send PDF documents back and forth with clients and between our changes and their's, we often end up with dead bookmarks in the file and I'd like an easy way to identify and resolve those.
Any help would be greatly appreciated! THank you!
Are these bookmarks only pointing to pages in the same file, or can they do other things as well? If the former then it might be possible to do it with a script, but it's quite tricky.
All the bookmarks are just pointing to pages in the same file. Nothing outside.
In that case it might be possible. You would need to write a recursive function to iterate over the entire bookmarks hierarchy, executing each one and checking whether it's causing the document to change page number. If you do that multiple times and it never changes, it's most likely a dead bookmark.