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

Remove specific repeated top level bookmarks

New Here ,
May 18, 2020 May 18, 2020

Hi there!

I'm looking into removing specific bookmarks (repeated) from a bulk invoice PDF which is generated by our e-commerce platform automatically (300 invoices in one PDF file). 

 

Screenshot 2020-05-18 at 18.02.28.png 

 

As you see there are two top level bookmarks in each invoice, I'm trying to figure how to remove all the "Ordered products" bookmarks with a script, so that I could use the Split function to split all 300 invoices by Top Level of Bookmarks.

 

I know: 

this.bookmarkRoot.remove(); would remove everything

and I have tried:

this.bookmarkRoot.remove("Ordered products"); which did not work

 

Anyone could please help me the novice here ? 🙂

 

Thank you so much in advance!

TOPICS
Acrobat SDK and JavaScript
1.2K
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 , May 18, 2020 May 18, 2020

You can use this code to achieve it:

 

for (var i=this.bookmarkRoot.children.length-1; i>=0; i--) {
	var bkm = this.bookmarkRoot.children[i];
	if (bkm.name=="Ordered products") bkm.remove();
}
Translate
Community Expert ,
May 18, 2020 May 18, 2020

You can use this code to achieve it:

 

for (var i=this.bookmarkRoot.children.length-1; i>=0; i--) {
	var bkm = this.bookmarkRoot.children[i];
	if (bkm.name=="Ordered products") bkm.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 ,
May 19, 2020 May 19, 2020
LATEST

That's so cool, works perfectly! Thank you so much for helping out! 

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