Poll

Aboot this blog

This blog is a cross between a scrapbook and a diary. I hope you find something here of interest. If you’d like to keep up with things as I see them then you can subscribe to my news feed by clicking the icon below:

feed-icon-28x28.png

DISCLAIMER

Please note that any reviews/recommendations are based solely on my own experience and does not constitute a guarantee that you will have the same experience. Please do your own research before parting with any money - the risk is all yours!

The Briticiser

Looking for my world famous US to GB English spelling converter?

THE “BRITICIZSER”

www.us2uk.eu

IT’S HERE

Tags

  Odds and Sods     PHP     Flatpress     Browsers     Hardware     Reviews         Bookmarks     Education     Windows     Overcoming Disabilities     News     Family     Software     Acrobat     Word     Excel     VBA     Utilities     Plausible Lies     Bits and Bobs     Tutorials     Equipment  

Find me on Facebook

facebook-icon-28x28.pngVisit my Briticiser Facebook Page to keep up with things here - lots of reviews of stuff I’ve really used and also all kinds of helpful computer tips with a heavy bias towards SAVING YOU TIME.

How to add the file name to a batch of PDFs

Permalink: http://paul.us2uk.eu/?x=entry:entry130212-182727

*Updated September 2015*

Note - since Acrobat Version X Batch Processes are called “Actions”. To learn how to create an Action to add the file name and page number to a batch of PDFs click the following link:

How to add the file name and page number to multiple PDF files in Acrobat X Professional

In this post on Monday I described a rather clunky way to add the file name to the footer of a PDF. I then went in search of a solution which would let me do the same to a whole batch of PDFs – and here’s how to do it. This works in Adobe Acrobat Professional Version 7 but it should be easy enough for users of other versions to get this to work for them too. Please remember that this will only work in the Professional versions of Acrobat (the versions you pay for) and not the free version of Acrobat Reader.

Credit where credit is due

Before I begin credit for this solution goes to a couple of users on the Adobe Community – primarily to ReinhardF who, way back in 2006, posted this solution which allows you to add the file name, date, and page number to the footer of a PDF:

http://forums.adobe.com/thread/302996

This wasn’t an immediate solution to the batch process I was looking for, but it did add a quite user-friendly set of options to Acrobat’s main File menu.

Another user by the name of johnbullas also took that solution as a lead, and developed a script which could be directly included in a batch process. The script at the bottom of the following thread is actually a little screwed up, but read on and I’ll show you how I cleaned that up and got it to work:

http://forums.adobe.com/message/4172516

Here we go

I’m actually going to show you how to use both of the above solutions because the File menu option is pretty neat, so I’ll show you how to add that first.

The following picture shows you what the menu looks like – you can see it gives you several options there and clicking one will apply the relevant stamp to whichever PDF file you have open.

Acrobat Set/Remove Footer File Menu Options

You can add this menu in just 2 easy steps.

  1. Right click this link and save the linked .js file to your Acrobat JavaScripts folder. On my computer this folder could be found at Program Files>Adobe Acrobat 7.0>Acrobat>JavaScripts. If you can’t find it there take a look around in your profile folder under Documents and Settings – it may be lurking under Application Data, or Local Settings>Application Data instead.
  2. Close and then reopen Acrobat – your new menu options should appear as shown above.

That’s it!

Open up a test PDF document to try the different menu options to see what they do.

Running the script in batch mode

Using this script in batch mode is actually very easy. All you need to do is enter a single line of code to call the function in the JavaScript which you’ve just installed. You’ll need to create a new batch process to run the JavaScript but this is very easy to set up, as you can see below.

1. Open up Acrobat and choose Advanced > Batch Processing…

This will display the following dialogue box. When you see this click on the first button labelled “New Sequence…”.

Batch Process Manager

2. A small box will appear prompting you to enter a memorable name for the sequence (batch process). Enter a suitable name and then click the “Ok” button.

Name Sequence Prompt

3. You will then be presented with another screen where you can edit your new batch sequence. Click on the “Select Commands…” button at the top.

Edit Batch Sequence Screen 

4) The next screen you see shows you a list of commands on the left which you can add to the the window on the right. Any commands in the right-hand window will be executed in the order in which they’re shown in the list. You can also see there are buttons to move commands up and down.

In our case we just want to add a single command, so scroll down the list on the left until you see “Execute Javascript” Click on it and then click on the “Add” button to add it to your batch sequence commands list.

Choose commands for batch sequence

Here comes the fun bit.

5. Once you’ve added the command click on the “Edit button” (the last button in the centre row). This will open up the JavaScript Editor: Javascript Editor

6. Copy and paste the following script into the window:

/* Call SetFooter(ARG) /
/
1 - Set Date Time (Filename) /
/
2 - Set Date …. centered /
/
3 - Set Date …. right /
/
4 - Set Page centered /
/
5 - Set Page right /
/
6 - Set Both */

SetFooter(1)

Like so:

image

Most of what you see above are comments. The actual JavaScript is the last line and you can see that you can change the argument (the “1”) to any of the six options shown in the comments. These options correspond to the new options which were made available to you in the File menu when you saved the .js file but you’ll need to click on the “Select Commands…” button in the commands selection screen if you want to change this from the default option you’ve just pasted in there.

7. Click on “Ok” to save this script, then click “Ok” when you return to the commands selection screen which we saw in step 4). This will take you back to the Edit Batch Sequence Screen (see step 3) where will now show your new JavaScript command.

Your chosen command appear in the batch sequence editor

You can leave the second option alone if you want to be prompted to select which files to run your batch sequence on, or you can preset a folder or a selection of files here - it depends on your work flow which way you want this to work.

The third option allows you to either save the files in the same folder as the originals, or set a new output folder. You can also get it to not save the files at all - something which you might find useful if you just want to stamp the date when you are batch printing a lot of files, but don’t want to permanently add this information to the file.

The “Output Options…” button takes you to the following screen where you can make a number of additional choices of what you want Acrobat to do with your files when you run your batch sequence, Output Options

If you intend saving the new files to the same folder as the originals you can either choose to overwrite the  existing files or you can add some text to the file name. In the example above we’re going to output new files and append “-stamped” to the original file name, right before the file extension. You can also choose to save your files in a different format to PDF, e.g. to plain text or to an image format.

Click “Ok” to save your chosen options then click “Ok” again in the batch sequence editor to return to the main batch sequence management screen, where you will see your new sequence all set and ready to run.

Your new batch sequence is now shown in the main batch sequence management screen

8. Click “Run Sequence…” and you will see a confirmation screen showing you basic details about the batch sequence you are about to run.

image

9. Click “Ok” and you will be prompted to choose which files you want to run the batch sequence on.

Navigate to the folder containing the files you want to include then select the ones you want to stamp, then click the “Select” button.

navigate to the folder containing your working files and select them

10. The process will now run and a progress monitor will appear to show you that the process is underway. However in our case the sequence ran so quickly that the progress monitor only briefly flashed on the screen.

Batch Sequence Progress Monitor

At a rough estimate this process will stamp and save files at a rate of 10 per second - which should be fast enough for most people.

When the sequence has finished you’ll return once again to the main batch sequence management screen. You can close this now and return to the main Acrobat window.

When you choose to open a file you’ll see that your new files are now shown in the same folder as your originals.

Processed files are now available for viewing

Open one up and you’ll see that your files are all neatly stamped with the file name!

Come on Darlo!

What if you just want to show the file name and the page sequence number?

If you just want to show the file name, and you feel all experimental, then you could tweak the JavaScript in the .js file you downloaded to give you that additional option. Alternatively here’s the second script I mentioned earlier, which was specifically written to be inserted and used in a batch sequence. This script will do just that.

Simply go back to step 6 in the above tutorial and enter this script in the JavaScript editor instead… or create a new batch sequence specifically for it and take your pick which sequence to run.

Hope this helps someone!

If you just want the File Name to show in the footer simply edit the line in the second section of this code which starts “fd.value = ” to read “fd.value = FileNM;” (without the quotes) ]

image

Note: You can download a zipped up .js file containing the above code here:

pdf-add-filename-pageno-to-footer.zip

Support our caregiving

If you found anything on this site of use, interesting, or even mildly amusing then please consider dropping a few pennies in the jar to help us to take care of our disabled son who contracted encephalitis in 2007 at the age of 6 and who is now confined to a wheelchair. He is getting bigger as his mother and I get older, imagine that, please. Every penny we collect goes towards his upkeep, and towards his future care requirements.

Thank you.

Support our caregiving

Support our caregiving

If you found anything on this site of use, interesting, or even mildly amusing then please consider dropping a few pennies in the jar to help us to take care of our disabled son who contracted encephalitis in 2007 at the age of 6 and who is now confined to a wheelchair. He is getting bigger as his mother and I get older, imagine that, please. Every penny we collect goes towards his upkeep, and towards his future care requirements.

Thank you.