Copy link to clipboard
Copied
Hi all,
I have to bookmark multiple PDF files reflecting the file name of the document (275 files). For example, if the document name is Javascript 2018.pdf, the bookmark will be Javascript 2018.pdf (I was already able to come to this step). The only thing I do not want is that the bookmark contains the '.pdf' part. Is there a script to remove this part of the bookmark in all files at once?
I am not really familiar with Javascripts, so you help is much appreciated.
Thanks,
Maikel
OK, then create an Action in the Action Wizard that executes this code and run it on your files:
if (this.bookmarkRoot.children!=null) {
for (var i=0; i<this.bookmarkRoot.children.length; i++) {
var bkm = this.bookmarkRoot.children;
bkm.name = bkm.name.replace(/\.pdf$/i, "");
}
}
Don't forget to add a Save command after the Execute JavaScript command.
Copy link to clipboard
Copied
Is your bookmark tree flat (ie, one level), or does it have multiple levels? If the latter, do you want to remove that term from all levels, or just the top one?
Also, to be able to process multiple files you will need Acrobat Pro. What version of Acrobat do you have?
Copy link to clipboard
Copied
In this case it is a flat tree, the documents only contain one bookmark so it is only for one level.
The version I use is Adobe Acrobat XI.
Maikel
Copy link to clipboard
Copied
Adobe Acrobat XI Pro or Standard? Look under Help - About Adobe Acrobat.
Copy link to clipboard
Copied
Adobe Acrobat XI Pro
Copy link to clipboard
Copied
OK, then create an Action in the Action Wizard that executes this code and run it on your files:
if (this.bookmarkRoot.children!=null) {
for (var i=0; i<this.bookmarkRoot.children.length; i++) {
var bkm = this.bookmarkRoot.children;
bkm.name = bkm.name.replace(/\.pdf$/i, "");
}
}
Don't forget to add a Save command after the Execute JavaScript command.
Copy link to clipboard
Copied
This works perfectly, many thanks!