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

Help Inserting Page From File For Many Files And Repeating For Many Folders

Community Beginner ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

I have a simple action that I am having trouble expanding into a repetitive process one level higher.

Problem:  Have a cover page PDF for personal records PDFs.  The cover page needs to be inserted before the first page in each personal record PDF for each person.  The cover page is unique for each person.

Problem overview:

- Have records for many people

- Each person has a cover page (00.pdf)

- Each person can have 1-99 record PDFs

- Each Person has a folder named their name

- All files for the Person are located within their Name Folder

I have two ways of structuring the organization of the cover page (00.pdf) and personal records (01.pdf-99.pdf):

1. All files within the root of the Name folder

      \Smith,Jane\00.pdf, 01.pdf ...10.pdf

2. Cover page in root of Name folder and All personal records within a Records subfolder

      \Smith,Jane\00.pdf

      \Smith,Jane\Records\ 01.pdf ...10.pdf

I can easily create an action to Insert the cover page PDF before the first page of each personal record PDF for a SINGLE PERSON (Smith, Jane).

My sticking point is automating this to process ALL the person folders.  In other words, just extend this out as a loop to process all folders of the next higher level (\People) -

  \People\

      \Able, Andrew

      \Smith, Jane

      \Smith, John

I am not a JavaScript expert, but understand basic programming.  This would appear to be a fairly basic problem if I knew more about the programming involved.  I would think a "For" or "While" loop or equivalent would need to be involved.

Thanks in advance for your help.

bcblmb

TOPICS
Edit and convert PDFs

Views

460

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 , Apr 24, 2017 Apr 24, 2017

Ah, I see the problem... Use this code instead of the one above:

if (this.documentFileName!="00.pdf")

    this.insertPages({nPage: -1, cPath: "00.pdf"});

Votes

Translate

Translate
Community Expert ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

If you place the cover page in the same folder as the rest of the files it is very easy to insert it into them using an Action and a script, no matter where they are located.

The code to do it is basically this:

this.insertPages({nPage: -1, cPath: "00.pdf"});

That's all there is to it. Add a Save command after the command that executes this JS code, and then run the Action on the parent folder ("People") and you're done!

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 Beginner ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

If I understand this correctly, I need 2 Actions:

1.  To save the cover page (00.pdf) for each of the "other" (01.pdf, 02.pdf ...99.pdf) files in the Person folder

2.  An Action that uses / calls Action #1 above on the parent folder ("People")

So an Action can call another Action?  I thought that was not possible???

I was hoping to avoid all the programming of getting acrobat to loop through all the "Other" files and / or the entire "People" folder

Thanks in advance

bcblmb

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 ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

No, an Action can't call another Action, and it's not what I meant.

I thought you said the cover file was (or could be) in each sub-folder...

If that's not the case then where is it located?

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 Beginner ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

The cover file (00.pdf) is in each subfolder.

When I insert the JS code, the coverpage (00.pdf) is inserted into itself and saved. 

Then 00.pdf has 2 cover pages, which is then inserted into all the "other" files.

I could run another action to delete the first page of all files to get rid of the second copy of the coverpage.

What code would I insert to not execute the this.InsertPages instruction?

Thanks in advance,

bcblmb

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 ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

LATEST

Ah, I see the problem... Use this code instead of the one above:

if (this.documentFileName!="00.pdf")

    this.insertPages({nPage: -1, cPath: "00.pdf"});

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