Skip to main content
Participant
January 21, 2025
Answered

Delete text from bookmarks

  • January 21, 2025
  • 2 replies
  • 679 views

I have a PDF with 200 bookmarks. In these 200 bookmarks each bookmarks starts with 001, 002, 003 then some individual text after these 3 numbers. I would like to delete the 3 numbers in each bookmark but keep the individual text. I have adobe Acrobat and plugin bookmark and splitdocuments. I am deseperate for help. 

Correct answer try67

This might delete other numbers as well. I would adjust it to:

 

.replace(/^\d*\s*/, "");

2 replies

JR Boulay
Community Expert
Community Expert
January 22, 2025

Run this script in the JavaScript console:

 

for (var i=0; i<this.bookmarkRoot.children.length; i++) {
var bkm = this.bookmarkRoot.children[i];
bkm.name = bkm.name.replace(/\d\d\d/g, "");
}

 

 

Or run this one if after the 3 digits there is a space that you also want to delete:

 

for (var i=0; i<this.bookmarkRoot.children.length; i++) {
var bkm = this.bookmarkRoot.children[i];
bkm.name = bkm.name.replace(/\d\d\d\s/g, "");
}

 

 

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 22, 2025

This might delete other numbers as well. I would adjust it to:

 

.replace(/^\d*\s*/, "");

Participant
January 22, 2025

THANK YOU so much! This script worked and saved me days of removing it manually. Time saved is money saved as we say in Norway 🙂 

try67
Community Expert
Community Expert
January 21, 2025

Are the bookmarks all at the top-level, or are there sub-bookmarks, sub-sub-bookmarks, etc.?

Participant
January 22, 2025

They are all at top level.