• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

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

207

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

Community Expert , 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
Community Expert ,
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
Community Expert ,
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