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

Deleting the same field across multiple pages

New Here ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

I have a 200+page PDF that has hundreds of fields per page. The pdf is generated from an ERP system, but does not have the fields when it is created, so I run the auto detect forms feature so they can be filled out. All of the fields are created correctly with the exception of ONE! Acrobat puts the form in the wrong spot on the page.

Is there a way to remove ALL of this one field, on each of the pages of the PDF?

Since the Auto Detect feature is used the name of the field is incremented on each page, so the names are not identical.

The naming structure of the filed is "Enter Biweekly Oncall Amount" then increments as Enter Biweekly Oncall Amount_1, _2, _3 etc.

I've seen solutions for identically named fields, but the incrementing  is giving me trouble.

TOPICS
Edit and convert PDFs

Views

1.1K

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 , Jun 05, 2017 Jun 05, 2017

Sure, it's possible. Run this code from the JS Console:

var counter = 0;

for (var i=this.numFields-1; i>=0; i--) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    if (/^Enter Biweekly Oncall Amount/.test(f.name)) {

        this.removeField(f.name);

        counter++;

    }

}

app.alert("Deleted " + counter + " fields.",3);

Votes

Translate

Translate
Community Expert ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

Sure, it's possible. Run this code from the JS Console:

var counter = 0;

for (var i=this.numFields-1; i>=0; i--) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    if (/^Enter Biweekly Oncall Amount/.test(f.name)) {

        this.removeField(f.name);

        counter++;

    }

}

app.alert("Deleted " + counter + " fields.",3);

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 ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

I must be doing something wrong.

app.alert("Deleted " + counter + " fields.",3); 

counter is not defined

1:Console:Exec

ReferenceError: counter is not defined

1:Console:Exec

undefined

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 ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

You need to select the whole code before executing it. Otherwise it will

only execute the current line you're on...

On Mon, Jun 5, 2017 at 10:29 PM, No1UCFfan97 <forums_noreply@adobe.com>

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 ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

LATEST

Fantastic! thank!

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