Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Batchprocessing with Acrobat DC

Community Beginner ,
Apr 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

Hi,

I would like to extract the first page each out of a batch of pdf files and store it in one separat folder on a Apple MAC.

I've got the information, that there ist no action in Acrobat itself.

May be someone knows something about an combination with Acrobat and the Automator program from Apple?

Or, is there a Script for those doings?

Thanks for help.

Alfred J.

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

176

Likes

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

Adobe Community Professional , Apr 13, 2018 Apr 13, 2018
Don't know where you found this information, but it can certainly be done using a script and an Action in Acrobat Pro (which I assume you have, since you're on a Mac).The folder must exist in advance, though. The script can't create it for you.The tricky part is to find the internal path of that folder.To do so put a PDF file there and then open it in Acrobat.Then press Cmd+J to open the JS Console, and paste this code into it:this.pathThen press Cmd+Enter (using the Enter key in the numeric pad...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

Don't know where you found this information, but it can certainly be done using a script and an Action in Acrobat Pro (which I assume you have, since you're on a Mac).

The folder must exist in advance, though. The script can't create it for you.

The tricky part is to find the internal path of that folder.

To do so put a PDF file there and then open it in Acrobat.

Then press Cmd+J to open the JS Console, and paste this code into it:

this.path

Then press Cmd+Enter (using the Enter key in the numeric pad) and it will print out the file path.

Copy everything up to the file name, including the forward slashes, and then you could use that in the code to extract the first pages of your files, which will be:

var outputPath = "..."; // replace ... with the text you copied before

this.extractPages(0, 0, outputPath + "Page 1 from " + this.documentFileName);

That's it. You can run this Action on your files and the first page from each one will be saved in that folder.

If you need help setting up the Action let me know.

Likes

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 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

Hi try67,

many thanks for this.

First I,ve never programmed any skript intentional.

I did an batch with the Apple Automator for multi renaming, not more.

In which App or program I have to copy the code for this action?

Is it internal Acrobat or is it an extra Skript Editor?

Where do I advice the skript which pdf files it should use? The aim folder from above, is where the single pages will be stored.

I tried it with the onbord Skript Editor and got an error with "this.extractPages" as no function.

So my questions are

Which app contains the code?

How do I have to collect the source files for the action?

How to start the action?

As the path is for one folder, the next time I will need to change the skript, or get them all in the named one.

Alfred J.

Likes

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
Adobe Community Professional ,
Apr 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

> Which app contains the code?

- Adobe Acrobat Pro

> How do I have to collect the source files for the action?

- You go to Tools - Action Wizard and create a new Action.

Add to it a "Run a JavaScript" command and paste the code into the editor window that opens.

Then you save the Action. Let's call it "Extract First Pages".

When you run this Action you will be able to select which files it processes. See the next question.

> How to start the action?

- Go again to Tools - Action Wizard and click on "Extract First Pages" you just created.

Click the Add Files/Add Folder button to select which files to run it on, and then click on Start.

Wait until it processes all the files and then check out output folder.

It's possible the last file will remain open (it's a bug in Acrobat). You can close it manually.

> As the path is for one folder, the next time I will need to change the skript, or get them all in the named one.

- Sorry, I don't follow what you mean. If you want to change the path of the folder where the extracted pages are located you will need to edit the code before running the Action.

Likes

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 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

Hi, try67,

thanks a lot for the very good advices.

It works.

The only thing is, that I have to close with "OK" the JavaSkripts-Editor window each time it runs to the next file.

So the process will not work automatically with all collected files.

Could I add something like a "for ( var i = 0;..." to run it through the file list?

Alfred J.

Likes

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
Adobe Community Professional ,
Apr 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

No, what you need to do is go back to editing the Action and un-tick the box underneath the "Execute JavaScript" command, which says "Prompt User":

Likes

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 13, 2018 Apr 13, 2018

Copy link to clipboard

Copied

Hi try67,

thanks a lot.

Now it works through all files.

That helps much.

Good to know where to get help.

Kindest regards

Alfred J.

Likes

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 ,
Apr 14, 2018 Apr 14, 2018

Copy link to clipboard

Copied

LATEST

I did an batch with the Apple Automator for multi renaming, not more.

[Irrelevant links removed. -Moderator]

Likes

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