PDF Tools· 7 min read

Resizing PDF Pages: MediaBox Manipulation & Transformation Matrices

Understand how pdf-lib alters coordinate systems to scale or pad pages, the geometric differences between ISO 216 and ANSI standards, and how to prevent aspect-ratio distortion.

By EasyPDF Team Last updated: 2026-08-16

The mechanics of the PDF MediaBox

A PDF does not inherently know it is a piece of paper. Instead, it defines its boundaries using a mathematical rectangle called the MediaBox, which establishes the coordinate space for all visible content on a single page. The MediaBox is typically defined in PostScript points (where 1 point = 1/72 of an inch), starting from the bottom-left corner (0, 0) and extending to the top-right corner (width, height).

When you resize a PDF page, you are fundamentally rewriting this coordinate array. However, changing the MediaBox dimensions alone does not move or scale the visual content within it. If you simply expand the MediaBox, the existing content remains anchored to the bottom-left coordinate, leaving an empty void of white space around it. If you shrink the MediaBox, the content is abruptly cropped.

To properly resize a page, a tool must decide whether to manipulate the content's transformation matrix to fit the new boundaries, or to expand the boundaries and leave the content matrix untouched. This is the core mathematical distinction between scaling and padding.

Standard paper sizes and aspect ratios

Choosing a target paper size is not just about physical dimensions; it is about aspect ratios. The ISO 216 standard (A-series) and the ANSI/ASME Y14.1 standard (Letter) use completely different mathematical ratios, which directly impacts how content maps to the new page.

Standard paper sizes and aspect ratios (Table)

| Standard | Target Size | Dimensions (mm) | Dimensions (points) | Aspect Ratio |

| --- | --- | --- | --- | --- |

| ISO 216 | A3 | 297 × 420 | 841.89 × 1190.55 | 1:1.414 (√2) |

| ISO 216 | A4 | 210 × 297 | 595.28 × 841.89 | 1:1.414 (√2) |

| ISO 216 | A5 | 148 × 210 | 419.53 × 595.28 | 1:1.414 (√2) |

| ANSI | Letter | 216 × 279 | 612 × 792 | 1:1.294 |

The A-series relies on a √2 aspect ratio, meaning an A3 folded in half perfectly yields an A4. Letter has a wider, shorter profile. Because these ratios differ, converting an A4 PDF to Letter (or vice versa) will always result in either margin distortion or uneven whitespace if scaled uniformly.

Scale to fit vs. Pad with margins

This tool provides two distinct mathematical modes for handling the transition between the original MediaBox and the target MediaBox.

Scale to fit modifies the page's transformation matrix. It calculates a scaling factor based on the ratio of the target width to the original width, and the target height to the original height. It applies this scale factor to the content stream, physically shrinking or enlarging the text, vectors, and images to fit the new boundaries. This is mathematically akin to zooming in or out on the document.

Pad with margins leaves the content stream's scale factor at 100% and alters only the MediaBox dimensions. If you are padding to a larger page size (e.g., A4 to A3), the content remains its original physical size, and the tool generates new, empty margin space around it. This is highly useful for adding bleed areas or binding margins without altering the legibility of the original text.

How to resize your document instantly

The tool utilizes pdf-lib to perform structural document alterations entirely in your browser's memory, bypassing the need for server-side rendering.

Drop your PDF onto the upload zone. The tool parses the file structure and isolates the individual page dictionaries.

Choose a target size: A4, Letter, A3, or A5.

Pick a mode: Scale to fit (rescales content to the new boundaries) or Pad with margins (keeps original content size, alters the page canvas).

Click Resize & download. The tool rewrites the MediaBoxes, applies the necessary transformation matrices, and downloads the new file instantly.

Aspect ratio distortion and failure modes

When using the Scale to fit mode, the most common failure mode is aspect ratio distortion. If you convert a document from A4 (1:1.414 ratio) to Letter (1:1.294 ratio), a pure uniform scale is mathematically impossible without either stretching the content or leaving whitespace.

To handle this, scaling algorithms typically calculate the scale factor required to fit the width and the scale factor required to fit the height, and then apply the smaller of the two to ensure no content is clipped. This results in uniform scaling but introduces unequal margins on the sides or top/bottom. If the tool forcefully scales the X and Y axes independently to fill the entire page, the text will appear vertically stretched or horizontally squashed, degrading readability.

Warning: When scaling down to a smaller format (e.g., A4 to A5), font sizes shrink proportionally. A 12pt font on an A4 page becomes roughly 8.5pt on an A5 page. If the original document already has small text, scaling it down may push the font below the threshold of legibility.

Preservation of interactive elements

A major concern when manipulating PDF transformation matrices is the preservation of interactive elements like form fields, hyperlinks, and annotations. Because the tool operates via pdf-lib, it manipulates the high-level PDF object structure rather than rasterizing the page.

In Scale to fit mode, the transformation matrix is applied to the content stream, but interactive form fields (AcroForms) can sometimes fail to scale visually, leading to misaligned input boxes. In Pad with margins mode, because the content scale remains 100% and only the MediaBox expands, all interactive elements, hyperlinks, and text vectors remain perfectly anchored and functional at their original coordinates.

Testing and verifying new dimensions

After resizing, it is critical to verify that the new MediaBox was written correctly. You can open the resized PDF in a standard viewer, but for exact verification, you should inspect the file's internal metadata. By running the resized file through a PDF Metadata Editor, you can confirm the exact page dimensions in points or millimeters.

Additionally, visually scan the first and last pages of the document. Ensure that headers and footers have not been clipped (a sign of a faulty scale calculation) and that the text is not horizontally stretched. If you need to remove the uneven margins generated by a scale operation, you can pass the file through a Crop PDF tool to trim the whitespace precisely.

Real-world document workflows

International Printing: Convert documents designed in North America (Letter) to the ISO 216 standard (A4) before sending them to European print houses to avoid automatic scaling errors on the printer's end.

Booklet Imposition: Pad smaller A5 pages onto A4 sheets with large margins to prepare them for booklet binding, ensuring the content isn't obscured by the spine.

Archival Standardization: Take a mixed batch of scanned documents (various sizes) and batch-resize them to a uniform A4 standard for consistent database storage. Combine this with a Compress PDF step to optimize the final file size.

Presentation Prep: Scale an A4 vertical report down to A5 for inclusion in a multi-column digital magazine, ensuring the text reflows proportionally to the new viewport.

Frequently asked questions

Q: What's the difference between Scale and Pad?

A: Scale changes the content size to fit the new page dimensions by applying a mathematical scale factor. Pad keeps the original content size and places it on the new page, adding empty margins to fill the difference.


Q: Is content preserved?

A: Yes. Text, images, and form fields are preserved. Only the page size and (in Scale mode) the content scale change. The tool does not rasterize or OCR the document.


Q: Is my PDF uploaded?

A: No. Resizing runs entirely in your browser via the pdf-lib JavaScript library. Your document data never leaves your device.


Q: Can I resize only specific pages?

A: This tool applies the new size to every page globally. For per-page resizing, you should extract the specific pages first, resize them independently, and then merge them back together.


Q: Why does my text look stretched after resizing?

A: This happens if the tool scales the X and Y axes independently to fill a page with a different aspect ratio (e.g., A4 to Letter). To avoid distortion, use Pad with margins, or ensure the scale mode maintains the original aspect ratio.


Q: Can I add custom dimensions instead of standard sizes?

A: This tool is optimized for standard paper sizes (A4, Letter, A3, A5) to ensure immediate compatibility with physical printers. For custom dimensions or trimming, use a dedicated Crop PDF or Rotate PDF utility.

Next steps for document standardization

Understanding how the PDF MediaBox and transformation matrices interact is the key to perfectly resizing documents without degrading quality. By choosing the correct scaling or padding mode, you ensure your content fits its new physical boundaries flawlessly.

Ready to format your document? Head over to the PDF Page Resizer tool page. For more document manipulation utilities, check our About page to learn more about EasyPDF's suite of client-side PDF tools.

Need help using this tool?

Read our complete PDF Page Resizer tutorial for step-by-step guidance.

Ready to try the tool?

No accounts. No uploads. No limits. Start now.