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

New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

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

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

78

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

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

New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

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

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

79

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
Dec 12, 2018 0
Most Valuable Participant ,
Dec 12, 2018

Copy link to clipboard

Copied

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.

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
Reply
Loading...
Dec 12, 2018 0
New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

I have Acrobat Pro DC.

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

Thanks

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
Reply
Loading...
Dec 12, 2018 0
Most Valuable Participant ,
Dec 12, 2018

Copy link to clipboard

Copied

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.

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
Reply
Loading...
Dec 12, 2018 0
Most Valuable Participant ,
Dec 12, 2018

Copy link to clipboard

Copied

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

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
Reply
Loading...
Dec 12, 2018 1
New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

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

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
Reply
Loading...
Dec 12, 2018 0