Need to delete all child bookmarks

New Here ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

Hi, please, i need to delete all child bookmarks, can you share a working javascript script that can do that please?

javascript.png

thanks

 

TOPICS
Acrobat SDK and JavaScript, Windows

Views

80

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Mar 27, 2021 Mar 27, 2021
You can use this code to do it: if (this.bookmarkRoot.children!=null) { for (var i=0; i<this.bookmarkRoot.children.length; i++) { var bkm = this.bookmarkRoot.children[i]; if (bkm.children!=null) { for (var j=bkm.children.length-1; j>=0; j--) { bkm.children[j].remove(); } } } }

Likes

Translate

Translate
Most Valuable Participant ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

You can use this code to do it:

 

if (this.bookmarkRoot.children!=null) {
	for (var i=0; i<this.bookmarkRoot.children.length; i++) {
		var bkm = this.bookmarkRoot.children[i];
		if (bkm.children!=null) {
			for (var j=bkm.children.length-1; j>=0; j--) {
				bkm.children[j].remove();
			}
		}
	}
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

thank you sir, you are the best. Please, how can i know what variables do i need to use, where can i see that please? (bookmarRoot, etc.) 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

LATEST

It's all in the JS for Acrobat API Reference, which is a part of the Acrobat SDK, available here: http://www.adobe.com/devnet/acrobat.html

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines