Skip to main content
Martine27000009zfkr
Known Participant
November 7, 2022
Question

Bookmark automation

  • November 7, 2022
  • 2 replies
  • 5810 views

Hi, I was wondering whether it was at all possible, from the Action feature or using some JavaScript, to automatically change the color of level-1 bookmarks in multiple PDFs (nor created from Word), and also to delete the first 2 bookmarks multiple PDFs.

Any idea will be welcome.

Thank you.

 

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
November 7, 2022

You can do is using this script (I used blue, since you didn't specify what color you wanted):

 

this.bookmarkRoot.children[0].remove();
this.bookmarkRoot.children[0].remove();
for (var i=0; i<this.bookmarkRoot.children.length; i++) {
	this.bookmarkRoot.children[i].color = color.blue;
}
Martine27000009zfkr
Known Participant
November 7, 2022

Thank you very much! How do I execute this, please?

 

 

Martine27000009zfkr
Known Participant
November 8, 2022

From the JS Console, a button, an Action or a Custom Command, among others.


Sorry, I ran it from here but it did not change anything in the selected PDFs:

 

Eric Dumas
Community Expert
Community Expert
November 7, 2022

Is that change the formatting in your document itslef or in the bookmark panel on the side of the screen?

Within a document, the bokmarks do not really have a hierarchy, only on the side panel. As far as i remember, the side panel keep the text for the bookmark with basic formatting options. more at Page thumbnails and bookmarks in PDFs, Adobe Acrobat (scroll half-way down the page) to 'Change the text appearance of a bookmark'.

You can also check this Developing Acrobat Applications Using JavaScript (adobe.com) (page 126-127).

 

Also, to automate the deletion, do the 2 bookmarks have the same name in each document? what do they have in common?

Martine27000009zfkr
Known Participant
November 7, 2022

Thank you, Eric. What I am referring to is the bookmarks on the side panel, which have 2 levels in my case, reflecting the heading levels within the document. I want only the level 1s to have a different color.

And concerning the bookmarks to be delete in the side panel, they are just the first ones there. The names will differ in the different PDFs (translations) but they will always be positioned as first and second in the bookmark side panel. They should remain within the document be disappear in the bookmark side panel.