Copy link to clipboard
Copied
I am using JavaScript to programmatically create bookmarks to specific pages (e.g. bookmarkRoot.children[0].children[0].createChild("My Bookmark", "this.pageNum=77");).
This works but I am sending the PDF to a company who do not allow JavaScript within documents. Is there a way to set a bookmark to a destination page programmatically without associating it with a JavaScript action?
I can go into the document, click on each bookmark to go to the correct page, then select Set Destination and that will replace the JavaScript actions with Adobe actions but I have to do this for many documents so would like to find an automated way of doing it.
1 Correct answer
You cannot do this with JavaScript, you would need a plug-in to do that. There are some 3rd party plug-ins that can read e.g. a text file and apply bookmarks (e.g. EverMap's AutoBookmark Plug-in - AutoBookmark Plug-in for Adobe Acrobat - PDF Bookmarking Functionality) , but if you want true programatic control over what goes where, you would need a custom plug-in, or a standalone application. A while ago I created that functional as part of a larger system in an Acrobat plug-in. If you are int
...Copy link to clipboard
Copied
No. At least not with Acrobat JavaScript. What authoring tool are you using to write the document?
Copy link to clipboard
Copied
Thanks for the quick response Joel.
The documents have been created externally and I am not sure what authoring tool was used. I just need to add the bookmarks. I'm using an open source tool (XPDF) to extract the text from the PDF, reading that in programmatically with SAS to pick out the information for the bookmarks and generating the JavaScript code to create the bookmarks.
Do you know of any alternatives to using JavaScript?
Copy link to clipboard
Copied
See Karl's answer above for alternatives. You may be able to remove XPDF from the process by using a plug-in.
Copy link to clipboard
Copied
You cannot do this with JavaScript, you would need a plug-in to do that. There are some 3rd party plug-ins that can read e.g. a text file and apply bookmarks (e.g. EverMap's AutoBookmark Plug-in - AutoBookmark Plug-in for Adobe Acrobat - PDF Bookmarking Functionality) , but if you want true programatic control over what goes where, you would need a custom plug-in, or a standalone application. A while ago I created that functional as part of a larger system in an Acrobat plug-in. If you are interested in a custom solution, please get in touch with me directly.
Copy link to clipboard
Copied
Thanks Karl
I downloaded a trial version of the Evermark plug in and it seems to do everything that I need. I'll let you know if we need a custom solution.

