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

Javascript for deleting certain word from bookmarks in multiple PDF files

New Here ,
May 28, 2018 May 28, 2018

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.0K

Translate

Translate

Report

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 28, 2018 May 28, 2018

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.

Votes

Translate

Translate
Community Expert ,
May 28, 2018 May 28, 2018

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?

Votes

Translate

Translate

Report

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 28, 2018 May 28, 2018

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

Votes

Translate

Translate

Report

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 ,
May 28, 2018 May 28, 2018

Copy link to clipboard

Copied

Adobe Acrobat XI Pro or Standard? Look under Help - About Adobe Acrobat.

Votes

Translate

Translate

Report

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 28, 2018 May 28, 2018

Copy link to clipboard

Copied

Adobe Acrobat XI Pro

Votes

Translate

Translate

Report

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 ,
May 28, 2018 May 28, 2018

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.

Votes

Translate

Translate

Report

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 28, 2018 May 28, 2018

Copy link to clipboard

Copied

LATEST

This works perfectly, many thanks!

Votes

Translate

Translate

Report

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