I recently recieved a really good tip on how to create a bookmark for showing the path to the pdf file (http://www.acrobatusers.com/forums/aucb … p?id=12939). It works great.
I have set it up as follows:
this.bookmarkRoot.createChild({cName: "path to report", cExpr: "console.show();console.clear();console.println(this.path);", nIndex: -1});
(although it doesn't go to the bottom of my existing bookmark list, but oh well...)
and saved it to a batch process.
Now i've been trying to create a batch process to do the reverse, i.e. remove the bookmark - if later we find we don't need this functionality any more.
I've read and read and read and tried various versions of a javascript without any luck - and maybe it's not even possible, but I though I would ask.
I know there is a method for removing ALL bookmarks at once:
this.bookmarkRoot.remove()
I only need to get rid of one... Why doesn't this work ?
this.bookmarkRoot.remove("path to report");
or this,
this.bookmarkRoot.remove({cName: "Path to report"})
Any tips / help ?
Thanks so much.
// Get index for last child of bookmarkRoot
var nLastIndex = (this.bookmarkRoot.children == null) ? 0 : this.bookmarkRoot.children.length;
// Create new last-child bookmark
this.bookmarkRoot.createChild({cName: "path to report", cExpr: "console.show();console.clear();console.println(this.path);", nIndex: nLastIndex});
//Delete last child index
// check first if last child is desired target
if(this.bookmarkRoot.children !=null && this.bookmarkRoot.children[this.bookmarkRoot.children.length - 1].name == "Path to report")
this.bookmarkRoot.children[this.bookmarkRoot.children.length - 1].remove();
If target bookmark is not guaranteed to be the last child of bookmarkRoot then you will have to search for it with a loop:
if(this.bookmarkRoot.children !=null)
for (var i=0; i