Other PDF Issues

How to Check and Validate PDF Page Size with Acrobat JavaScript

Steven ParkerSteven Parker Nov 3, 2026 868 views

Question details

The user needs to automate the process of checking whether a PDF file is exactly one page and has a Letter page size (8.5 by 11 inches) using Acrobat JavaScript or VBA.

How to Check and Validate PDF Page Size with Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Developing a VBA and Acrobat automation workflow to filter out PDFs that do not meet standard size and length criteria, which will then require manual page resizing.
Observed behavior
The user needs a script to accurately verify the page count and specific crop box dimensions without relying on manual checks or destructive 'Print to PDF' methods.
Before you start

Ensure you have Adobe Acrobat Pro installed and have basic familiarity with the Acrobat JavaScript API, as standard PDF readers do not support executing these advanced document scripts.

Solution 1Recommended

Validate Page Size Using the Acrobat JavaScript API

Use the getPageBox method in Acrobat JavaScript to retrieve the PDF's crop box dimensions in points and verify the page count.

In Adobe Acrobat, page dimensions are calculated in points rather than inches. One inch equals 72 points. Therefore, a standard Letter size page (8.5 x 11 inches) translates precisely to 612 points by 792 points. You can use a script to extract these dimensions and alert the user if they do not match.

1
Check the document page count

Use the 'numPages' property in your JavaScript code to verify the document's length. If 'numPages' is greater than 1, the document should be flagged.

2
Retrieve page dimensions

Call the function 'getPageBox("Crop", 0)' to get the boundary array of the first page. The array returns the coordinates of the crop box.

3
Calculate width and height

Calculate the width by subtracting the left coordinate from the right coordinate, and the height by subtracting the bottom coordinate from the top coordinate.

4
Implement the validation logic

Compare the calculated width and height to 612 and 792 points. If they do not match, trigger an alert to notify the user that the file has a different size.

Avoid Print to PDF for Resizing: Acrobat does not have a simple automated 'scale-to-page' feature for resizing. Using 'Print to PDF' as a workaround to resize documents is highly discouraged because it often results in lost interactive features, reduced quality, and stripped document metadata.
Powerful PDF Management

Easily Check and Adjust PDF Page Sizes with WPS Office

If writing JavaScript or VBA code is not suitable for your current project, WPS Office provides an intuitive visual interface to check document properties, crop pages, and manage PDF formatting effortlessly.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF file you need to inspect or resize.
  2. 2. Check current page properties: Navigate to the main menu and select 'Document Properties' to view the exact page size in inches or millimeters.
  3. 3. Adjust the page size: Go to the 'Page' tab and use the 'Page Size' or 'Page Margins' tools to manually adjust the PDF to a standard Letter size (8.5 x 11 inches) without degrading file quality.
Visual page resizing and cropping tools without any coding requiredPerfect format compatibility with Adobe PDF documentsBuilt-in tools to standardize page sizes across multiple documentsLightweight, fast, and features a user-friendly interface
microsoft office alternative - wps office

Frequently Asked Questions

Why is 8.5 by 11 inches equivalent to 612 by 792 points?

In PDF specifications and digital typography, one inch is exactly 72 points. Therefore, 8.5 inches multiplied by 72 equals 612 points, and 11 inches multiplied by 72 equals 792 points.

Can I automatically scale all PDF pages to Letter size using Acrobat JavaScript?

No, Acrobat JavaScript does not provide a built-in method to automatically scale page contents to a new size. You can modify the crop box dimensions, but scaling the actual content proportionately requires third-party plugins or manual adjustment.

Is it safe to use 'Print to PDF' to force a page resize?

Using 'Print to PDF' to resize documents is generally considered a last resort. It effectively flattens the file, which causes the irreversible loss of bookmarks, hyperlinks, tags, and can severely reduce image and vector quality.