Export PDF Page Dimensions to Excel Using Acrobat JavaScript
Question details
The user needs to extract the width and height of every page in a combined PDF document and copy this dimensional data into an Excel spreadsheet.

- Product
- Adobe Acrobat, Microsoft Excel
- Device & OS
- not provided
- Scenario
- Auditing or preparing documents where a precise, spreadsheet-friendly list of PDF page sizes (such as Crop, Trim, or Media box dimensions) is required.
- Observed behavior
- The user aims to generate a structured output using the Acrobat JavaScript Console that tabulates page numbers, widths, and heights for easy pasting into Excel.
Before running any scripts, determine which PDF page boundary you need to measure. A PDF contains multiple defined boxes (Crop, Trim, Media, Art, and Bleed), and your script must target the correct box for accurate calculations.
Use the Acrobat JavaScript Console to Output Dimensions
Execute a custom script in the Acrobat JavaScript Console to retrieve page properties and generate tab-separated values that paste perfectly into Excel.
PDF page dimensions are natively stored in points (1/72 of an inch). To get measurements in millimeters or inches, your script must perform a conversion. Using tab characters (\t) in your script's output ensures that Excel automatically splits the data into distinct columns.
Launch Adobe Acrobat, open your combined PDF document, and press Ctrl+J (Windows) or Cmd+J (Mac) to open the JavaScript Debugger Console.
Input a JavaScript loop that iterates through all pages (`this.numPages`). For each page, retrieve the dimensions of the desired box (e.g., `this.getPageBox("Crop", i)`).
Ensure your script concatenates the page number, width, and height variables separated by the `\t` string. Use `console.println()` to print each page's data on a new line.
Highlight all the code you just pasted into the console and press Ctrl+Enter (or Enter on the numeric keypad) to execute the script and generate the output.
Select the newly generated text in the console, copy it, open a blank Microsoft Excel workbook, and paste the values. They should automatically align into separate columns.

Easily Manage PDFs and Spreadsheets with WPS Office
While running custom JavaScript requires premium Adobe subscriptions, WPS Office offers a completely free, lightweight alternative. Featuring an integrated PDF editor and a powerful Spreadsheet tool, WPS Office lets you view PDF properties, convert PDF tables to Excel instantly, and seamlessly manage all your data in one familiar, easy-to-use application.
- 1. Download and Install: Download WPS Office for free from the official website and install the suite on your device.
- 2. Open WPS PDF: Open your PDF documents directly within WPS to view page properties or use built-in extraction tools.
- 3. Convert or Edit: Use the integrated PDF to Excel conversion feature to automatically extract data directly into WPS Spreadsheet without using code.

Frequently Asked Questions
What is the difference between CropBox and MediaBox in a PDF?
The MediaBox defines the physical physical dimensions of the page medium (such as A4 or Letter paper size). The CropBox defines the visible region of the page that is displayed or printed, after any margins or cropping have been applied.
Are PDF dimensions measured in inches by default?
No. Internally, PDF page dimensions are measured in points, where 72 points equal 1 inch. To export the dimensions in inches or millimeters, your JavaScript must divide the point value by 72 and multiply by the appropriate conversion factor.
Can I run Acrobat JavaScript without an Adobe Acrobat Pro subscription?
Generally, running custom page-level extraction scripts via the JavaScript Debugger Console requires Adobe Acrobat Standard or Pro. Basic free PDF readers do not typically support executing document-level JavaScript via a console.
Why is my copied console output appearing in a single column in Excel?
This happens when the script outputs spaces instead of tab characters. To fix this, edit your script to separate the values with a tab character (\t). Alternatively, you can paste the text into Excel and use the 'Text to Columns' feature to split the data.




