Skip to main content
Participating Frequently
Aug 2, 2019 11:42 PM UTC
Question

Is there a js command to open the bookmark tree in a collapsed state to only top level bookmarks?

My software makes hundreds of bookmarks in a hierarchy.  We want to open the bookmarks bar in a collapsed state showing only the first level bookmarks.  Is there a js - app.execMenuItem type command or any other to do this?

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

daitranthanhoa
Inspiring
Aug 5, 2019 6:57 AM UTC

This is script to expand bookmark:

this.pane = "bookmarks";

var myRoot = this.bookmarkRoot;

for (var i = 0; i < myRoot.children.length; i++)

{

   var child = myRoot.children;

   child.open=true;

}

Translate
Participating Frequently
Aug 3, 2019 3:01 AM UTC

Found one answer although a bit awkward at Re: Expand/Collapse all the Bookmarks in a PDF file   in case anyone else is looking.  Tks.

Translate
try67
Community Expert
Community Expert
Aug 3, 2019 9:32 AM UTC

If you're going to use the code from that thread, use the one posted by gkaiseril, as this needs to be done recursively.

I've also written a small (paid-for) tool that does it with a single click, if you're interested: Custom-made Adobe Scripts: Acrobat -- Close/Open All Bookmarks

Translate