Skip to main content
Participant
Mar 13, 2025 3:52 AM UTC
Question

Help creating automation for adding headers that reference file and folder name

Hi I am trying to figure out a way to help automate a header process. Below is my header that I want to create. As you can see, the center and part of the right column I want to make dynamic to reference the folder name and the first part of the file name. New to this- from what i have researched this seems possible using a set of guided actions that incorporates javascripts.

 

Overall I want to click 1 action and have acrobat do the following:

1. Flatten PDF

2. Shrink PDF contents so that adding header does not interfere with contents, maintains uniform margins across all files.

3. Add custom header as shown below

4. Save PDF

 

Would be even better if I can select multiple PDFs to all run at the same time.

 

 

All my file names have a "_" after the fixture type which should help when creating a script to retrieve the partial file names.

4 replies

JR Boulay
Community Expert
Community Expert
Mar 13, 2025 12:05 PM UTC

You can use JavaScript to split file names and place the split part in the form fields.

Then carry out steps 1, 2 and 4.

This can be done in an Acrobat action or in an application-level script.

Translate
Acrobate du PDF, InDesigner et Photoshopographe
PDF Automation Station
Community Expert
Community Expert
Mar 13, 2025 9:26 AM UTC

What type of files are those?

Translate
Participant
Mar 13, 2025 11:57 AM UTC

they are .PDF files. currently defaults to using Bluebeam

Translate
PDF Automation Station
Community Expert
Community Expert
Mar 13, 2025 1:32 PM UTC

Create a form field, or fields (left is left justified, center is center justified, right is right justified.  To the the folder name:

this.path.split("/")[this.path.split("/").length-2];

To get the file name:  this.documentFileName

To flatten:  this.flattenPages();

Use an Action with Execute JavaScript for the above, and use other action commands for the rest.

 

Translate