Skip to main content
peterb61739859
Participant
January 17, 2019
Answered

Creating Bookmark with Javascript works fine in Acrobat Pro but not in Acrobat Reader

  • January 17, 2019
  • 2 replies
  • 2212 views

Hello,

I added a simple JS function in Acrobat Pro DC, that creates a bookmark when a button is clicked. It works fine in Acrobat Pro, but when my client opened it in Acrobat Reader it didn't.

I also added some debugging alerts before and after the bookmark function to check whether the function is called in Reader and to exclude that there is an error in the line itself. Both were fired.

Here is the code:

function addBookmark(label) {
  var index = bookmarkRoot.children ? bookmarkRoot.children.length : 0;
  //bookmarkRoot.createChild(label, "this.pageNum = " + (this.pageNum), index);
  alert("bookmarkRoot'"+this.bookmarkRoot.children[0]+"'");      
  this.bookmarkRoot.createChild("Bookmark label", "this.pageNum = 4");    
  this.bookmarkRoot.createChild("Bookmark label2", '"this.pageNum=4"');     
  alert("finished");
}

Any ideas why the bookmarks aren't created and how can I proceed with debugging it?

Thank you in advance,

Peter

This topic has been closed for replies.
Correct answer try67

You can't add bookmarks in Reader, not manually nor using a script.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 17, 2019

You can't add bookmarks in Reader, not manually nor using a script.

Legend
January 17, 2019

No debugging needed, it's in the documentation:

It's vital to check the Quick Bar for every method you intend to use, especially but not only if you intend to use it in Reader.