These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How would I obtain the name and page # of the selected bookmark?

maleman2045
Registered: Feb 4 2008
Posts: 4

Good day,

How would I obtain the name and page # of the selected bookmark?
Using the JavaScript API, I can navigate through the collection of bookmarks, but there is no reference to obtaining the name of the bookmark currently selected by the end-user.

I am trying to create a function that will create set the attributes of an annotation when the user clicks a button to create an annotation with the bookmark name and page number.

My goal is to organize the annotations in the comments viewer by bookmark and the desired structure in the comments viewer is :

Bookmark Name
Page # - Annotation Type
Page # - Annotation Type
Another Bookmark Name
Page # - Annotation Type
Page # - Annotation Type

If the above hierarchical structure cannot be produced, then having the list flattened would be fine:

Bookmark Name : Page # - Annotation Type
Bookmark Name : Page # - Annotation Type
Another Bookmark Name : Page # - Annotation Type
Another Bookmark Name : Page # - Annotation Type

My initial targeted platform is to use JavaScript with Reader 8.x, but if this functionality can only be attained with 8.x Professional, that would be fine as well.

Any info you can provide would be greatly appreciated.

Many thanks in advance,

Mike Aleman

My Product Information:
Reader 8.1.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Bookmark creation is only available in Acrobat Pro or Standard. This is clearly indicated by the entry for the bookmark creation function in the Acrobat Reference.

There is no way to know which bookmark is selected. The information simply doesn't exist in Acrbat JavaScript. The only way to know the page number that a bookmark navigates to is to execute the bookmark, and there is a JavaScript function for this.

Further, you cannot use JavaScript to change the way in which comments are organized in the comment navigation panel, except by changing the comment's Author property, which a pretty slim level of control.

Some of these features would be very nice if they existed, However it appears that you are SOL on all accounts.

That's not to say that there aren't some things that you could do. For example when the user clicks on a bookmark, it's a good bet that the current page is going to be the bookmark target. You could create a folder level automation script that executes each bookmark until it finds the one that matches the current page. Then create an annotation on that page with the bookmarks name. It's not exact, but it might get you part of the way there.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script