Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Programmatically Creating a Bookmark To a Page Without JavaScript Actions

New Here ,
May 04, 2017 May 04, 2017

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.

TOPICS
Acrobat SDK and JavaScript , Windows
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 04, 2017 May 04, 2017

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

...
Translate
Community Expert ,
May 04, 2017 May 04, 2017

No. At least not with Acrobat JavaScript. What authoring tool are you using to write the document?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2017 May 04, 2017

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 04, 2017 May 04, 2017

See Karl's answer above for alternatives. You may be able to remove XPDF from the process by using a plug-in.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 04, 2017 May 04, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2017 May 04, 2017
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines