Show the working.
Small, inspectable examples make a measurement easier to trust. These are our own generated files, available for anyone to check.
Method version 1.0 · Published 1 October 2026
Download the sample collection
Open a file in the checker and compare its numerical output with the table below. The dimensions are expected visible sizes after rotation and UserUnit scaling. These values were calculated from the deliberately assigned coordinates.
| File / page | Case | Expected mm |
|---|---|---|
| Mixed / 1 | A4, 0° | 210 × 297 |
| Mixed / 2 | Letter, 0° | 215.9 × 279.4 |
| Mixed / 3 | A4, 90° | 297 × 210 |
| Mixed / 4 | Letter, 0° | 215.9 × 279.4 |
| Boundary / 1 | Five distinct declared boxes | 203.2 × 266.7 |
| Boundary / 2 | CropBox partly outside MediaBox | 215.9 × 254 |
| Boundary / 3 | 306 × 396 units, UserUnit 2 | 215.9 × 279.4 |
| Boundary / 4 | MediaBox origin (-72, -36) | 215.9 × 279.4 |
| Boundary / 5 | Reversed rectangle corners | 215.9 × 279.4 |
| Inherited / 1 | Boxes and 90° rotation on parent | 254 × 190.5 |
The mixed file must produce two groups of two when orientation is ignored, with no automatic comparison baseline because the groups tie. The inherited page’s MediaBox is 612 × 792 units; its CropBox is [36, 36, 576, 756], or 540 × 720 units before rotation.
Download the expected values as JSON · Download the fixture generator
To regenerate the samples with Node.js, install pdf-lib@1.17.1, import makeFixtures from the downloaded module, and call it with an output directory.
How dimensions are calculated
- Read the page tree with pdf-lib 1.17.1. Resolve inherited MediaBox, CropBox, and rotation; label absent optional boxes with their defaults.
- Normalize rectangle corner order and calculate width and height from coordinate differences. Do not assume the origin is (0, 0).
- For Visible area, intersect MediaBox and CropBox. For a named box, report its declared or defaulted extent without silently clipping it.
- Multiply each extent by the page’s UserUnit (default 1). Swap displayed width and height for 90° or 270° rotation.
- Convert to inches by dividing by 72, or to millimeters by multiplying by 25.4/72.
Reference: ISO 32000-1 (page objects, user space, and page boundaries) and the pdf-lib PDFPage API.
Grouping, naming, and precision
Groups use physical dimensions rounded to the nearest 0.1 mm. Two close dimensions can fall on opposite rounding boundaries; this is not a full tolerance-clustering algorithm. “Group portrait & landscape together” sorts the two dimensions before grouping. Disable it to separate the displayed orientations.
Paper names use a separate ±0.5 mm tolerance on each side for common A-series and US sizes. The label is approximate. The table shows two decimals for mm/pt and three for inches; CSV exports four decimal places in mm. Display precision is not a guarantee of printer accuracy.
Scope and limits
This is an independent geometry utility for document authors and reviewers. It does not render PDF content, execute embedded scripts, modify files, verify PDF/A or PDF/X, or certify a print workflow. It supports one file at a time, up to 50 MiB and 2,000 pages, with a 30-second processing timeout. Encrypted files and invalid page geometry produce an error.
The original sample set and generator are offered under CC0 1.0. You may reuse them to test your own reader. The samples are a compact regression set, not an exhaustive standard-conformance suite. pdf-lib is used under the MIT license.
Ready to measure your document?
Open the PDF checker ↗