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

Batchprocessing with Acrobat DC

Explorer ,
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

Views

471

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 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.path

Then press Cmd+Enter (using the Enter key in the numeric pad

...

Votes

Translate

Translate
Community Expert ,
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.

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
Explorer ,
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.

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 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.

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
Explorer ,
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.

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 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":

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
Explorer ,
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.

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 ,
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]

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