Skip to main content
Participating Frequently
August 2, 2019
Question

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

  • August 2, 2019
  • 2 replies
  • 746 views

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 has been closed for replies.

2 replies

daitranthanhoa
Inspiring
August 5, 2019

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;

}

Participating Frequently
August 3, 2019

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.

try67
Community Expert
Community Expert
August 3, 2019

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