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

Need to delete all child bookmarks

New Here ,
Mar 26, 2021 Mar 26, 2021

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
1.4K
Translate
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();
			}
		}
	}
}
Translate
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();
			}
		}
	}
}
Translate
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

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.) 

Translate
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
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

Translate
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