Last updated on
May 24, 2023
Summary
How to find an inactive bookmark, which does not have a target, in a PDF which has several bookmarks?
Objective
To check Inactive Bookmarks in a PDF using Acrobat.
Environment
Acrobat
Steps
There is no direct method to achieve it in Acrobat. You can use a script or third party plug-in to check for inactive bookmarks.
Sample JavaScript:
- Get list of all bookmarks using - var myBookmarksList = this.bookmarkRoot.children.
- Loop through each bookmark, that is, for (var i=0; i<myBookmarksList.length; i++)
- Within each iteration, set the current view to a value that is not the destination of a bookmark (for example, page = x, zoom = 1234)
- Execute the bookmark using myBookmarksList [i] = myBookmarksList [i].execute().
- If the view is different, then it is an indication that the bookmark is valid. Else, delete the bookmark using myBookmarksList [i].remove().