Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 Photoshoptographe
Copy link to clipboard
Copied
This might delete other numbers as well. I would adjust it to:
.replace(/^\d*\s*/, "");
Copy link to clipboard
Copied
Are the bookmarks all at the top-level, or are there sub-bookmarks, sub-sub-bookmarks, etc.?
Copy link to clipboard
Copied
They are all at top level.
Copy link to clipboard
Copied
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 Photoshoptographe
Copy link to clipboard
Copied
This might delete other numbers as well. I would adjust it to:
.replace(/^\d*\s*/, "");
Copy link to clipboard
Copied
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 🙂

