Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you! The actual script lines would be of great help!
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
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 😞
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
@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
Copy link to clipboard
Copied
I tried this today, but the text (report file) did not display the number of pages... I wonder where I went wrong.
Copy link to clipboard
Copied
You should find it here:
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
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.

