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

Adobe Acrobat Page Count Action for multiple files

Community Beginner ,
Jun 07, 2024 Jun 07, 2024

Hello

I need to have the page number for multiple pdfs in a folder, as a list.

Filename 1 = 5 pages

Filename 2 = 24 pages 

and so on

Ideally, the txt file would be saved within the folder.

 

Thank you!

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF , Standards and accessibility
1.8K
Translate
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Jun 07, 2024 Jun 07, 2024

1- Create a Preflight Profile Check (Print Production Tools : Preflight : Options : New Profile).

2- Use this Preflight Check in a Action (Action Wizard : New Action).

You can get a PDF, XML or TXT report.

 

Capture_2406071550.pngexpand image

 

Capture_2406071554.pngexpand image

 

 


Acrobate du PDF, InDesigner et Photoshoptographe

View solution in original post

Translate
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 ,
Jun 07, 2024 Jun 07, 2024

Creating a text file is tricky, but you can easily output this information to the JS Console and then copy it from there.

The code to do that is this:

console.println(this.documentFileName + " = " + this.numPages + " pages");

Then run this code as a part of an Action on your files, open the JS Console (Ctrl+J) when the Action is finished, and copy its contents to a text file.

View solution in original post

Translate
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 ,
Jun 07, 2024 Jun 07, 2024

Create an Action that executes a JavaScript.  The script will create a global variable that accumulates the document file names and corresponding number of pages with separators.  Create another script that creates a PDF, and then a data object text file (attachment) using the global variable string, replacing the separators with carriage returns, then deletes the global variable so it is "undefined" for the next Action run.

Translate
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 ,
Jun 08, 2024 Jun 08, 2024

Thank you! The actual script lines would be of great help!

Translate
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 ,
Jun 08, 2024 Jun 08, 2024

Here's the action:

 

 

if(global.page_Count==undefined)
{
var pg="pages";
if(this.numPages==1){pg="page"}
global.page_Count=this.documentFileName.replace(".pdf", "") + "=" + this.numPages + " " + pg+"--";
}
else
{
var pg="pages";
if(this.numPages==1){pg="page"}
global.page_Count+=this.documentFileName.replace(".pdf", "") + "=" + this.numPages + " " + pg+"--";

}

 

 

After the action runs you can test the result in the console by running this script:

global.page_Count

The result should be:

Filename 1 = 5 pages--Filename 2 = 24 pages--Filename 3 = 1 page-- (etc.)

If you run the following script in the console you can copy and paste the result into a text file:

 

global.page_Count.replace(/--/g,"\r");

When you are finished make sure you run the following script in the console:

 

delete global.page_Count;

The script above will ensure that if run the action again in the same session it does not add to the existing list.  If you still want to create the text list you can run the following script in the console, or create a custom menu item or toolbar button (the global variable can only be accessed in a privileged context):

 

var oDoc=app.newDoc();

oDoc.saveAs("/*the path where you want the pdf saved*/");
var data=global.page_Count.replace(/--/g,"\r");
oDoc.createDataObject("myList.txt",data);//creates text list attachment
oDoc.viewState = {overViewMode:7};//opens the attachment panel

delete global.page_Count;

Translate
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 ,
Jun 10, 2024 Jun 10, 2024

Thank you!

Try67's solution works perfectly.

Yours is more complex, thank you for taking your time to answer.

Your site is a powerfull resource, I am digging for helpful tips.

Thanlk you!

 

Translate
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 ,
Jun 07, 2024 Jun 07, 2024

1- Create a Preflight Profile Check (Print Production Tools : Preflight : Options : New Profile).

2- Use this Preflight Check in a Action (Action Wizard : New Action).

You can get a PDF, XML or TXT report.

 

Capture_2406071550.pngexpand image

 

Capture_2406071554.pngexpand image

 

 


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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 ,
Jun 08, 2024 Jun 08, 2024

Looks so simple and clean, yet the actual txt is not made. At the end of the action I get a report file and it sais that the txt is made, but the folder is empty 😞

Translate
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 ,
Jun 08, 2024 Jun 08, 2024

Yes, it's a bug that hasn't been fixed since February (contrary to what the development team had promised me).
I had to insist a lot and several times for them to provide me with a link to reinstall a 2023 version of Acrobat, so I think I'm going to have to wait a long time before triggering an update.

😞


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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 Employee ,
Jul 25, 2024 Jul 25, 2024

@Ella5EEC @JR Boulay 
I tested this scenario on my end today, July 25, 2024. And it is working fine on my end. I am getting the report that is expected of this action. Let me know if you see otherwise, we will take a look. 

~Tariq 

Translate
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 ,
Jan 09, 2025 Jan 09, 2025

I tried this today, but the text (report file) did not display the number of pages... I wonder where I went wrong. 

Translate
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 ,
Jan 10, 2025 Jan 10, 2025
LATEST

You should find it here:

 

Capture_2501101515.pngexpand image


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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 ,
Jun 07, 2024 Jun 07, 2024

Creating a text file is tricky, but you can easily output this information to the JS Console and then copy it from there.

The code to do that is this:

console.println(this.documentFileName + " = " + this.numPages + " pages");

Then run this code as a part of an Action on your files, open the JS Console (Ctrl+J) when the Action is finished, and copy its contents to a text file.

Translate
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