Skip to main content
subvet720
Participant
December 12, 2018
Answered

I have a bunch (1000+) drawings in PDF that I need to extract the page sizes of.

  • December 12, 2018
  • 3 replies
  • 600 views

I know how to x-fer the data to Excel, but can't figure out how to get the size from the file.

Any assistance will be appreciated.

Thanks

This topic has been closed for replies.
Correct answer try67

This code will do the former:

var pageBox = this.getPageBox("Crop", 0);

var pageWidth = pageBox[2]-pageBox[0];

var pageHeight = pageBox[1]-pageBox[3];

console.println(this.documentFileName + "\t" + pageWidth + "\t" + pageHeight);

When the Action is done open the JS Console window (Ctrl+J) and you'll be able to copy the text over directly to an Excel spreadsheet.

Notice the values shown are in PostScript Points, though. If you want another unit let me know and I'll adjust it for you.

Also notice that those values are of the first page's Crop box only. Each page has multiple boxes and each of those can be different in size...

3 replies

subvet720
subvet720Author
Participant
December 12, 2018

Outstanding! I really appreciate you assistance... Thanks!

subvet720
subvet720Author
Participant
December 12, 2018

I have Acrobat Pro DC.

Each drawing can be multiple pages, but the sheet sizes are constant within each drawing.

Thanks

try67
Community Expert
Community Expert
December 12, 2018

OK. You can use an Action to extract the sizes to the console (although that has limited capacity), to a Report object or even just to a global variable, which later on can be written out to a text file.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 12, 2018

This code will do the former:

var pageBox = this.getPageBox("Crop", 0);

var pageWidth = pageBox[2]-pageBox[0];

var pageHeight = pageBox[1]-pageBox[3];

console.println(this.documentFileName + "\t" + pageWidth + "\t" + pageHeight);

When the Action is done open the JS Console window (Ctrl+J) and you'll be able to copy the text over directly to an Excel spreadsheet.

Notice the values shown are in PostScript Points, though. If you want another unit let me know and I'll adjust it for you.

Also notice that those values are of the first page's Crop box only. Each page has multiple boxes and each of those can be different in size...

try67
Community Expert
Community Expert
December 12, 2018

What version of Acrobat do you have?

Do all the files have just a single page? If not, you'll need to export the sizes of all the pages, as they can vary.