PDF field reference · Tested 28 August 2026

PDF MediaBox vs CropBox

MediaBox describes the full physical page boundary. CropBox describes the region a viewer normally clips to when displaying or printing that page.

Changing CropBox usually changes what is visible—not what remains in the PDF.

See the recovery test ↓
01 · One-page model

Five boxes can describe one PDF page

The boxes are coordinates in default user space. They guide viewing, printing, trimming, and prepress workflows; they do not act like five independent layers of content.

Nested PDF page boxesA diagram showing MediaBox as the outer boundary and CropBox, BleedBox, TrimBox, and ArtBox as progressively smaller illustrative boundaries.MediaBoxCropBoxBleedBoxTrimBoxArtBox
This nesting is an explanatory model, not a rule that every PDF contains five explicit boxes or that CropBox must sit in this exact order. When CropBox is absent, its default is MediaBox.
MediaBox

The complete page boundary

It defines the physical medium for the page. Content outside it can be discarded without changing the intended PDF page.

CropBox

The normal display and print clip

It tells conforming viewers which rectangle to display or print. It imposes clipping; it does not itself rewrite the page content stream.

BleedBox

Production bleed

It can include extra image area needed to tolerate cutting and finishing variation.

TrimBox + ArtBox

Finished page and meaningful art

TrimBox describes intended finished dimensions; ArtBox describes the extent of meaningful content as intended by the creator.

02 · What a crop changes

One page dictionary, two different rectangles

In our Letter-size sample, the MediaBox stayed fixed while CropBox moved inward. The content stream and embedded resources remained in the file.

Before
MediaBox [0 0 612 792]
CropBox  [0 0 612 792]
After Doruni crop
MediaBox [0 0 612 792]
CropBox  [55.08 63.36 556.92 728.64]

The PDF array stores lower-left and upper-right coordinates. Doruni’s interface presents margins, then its current implementation reads the existing CropBox and writes the resulting rectangle with setCropBox(). It does not change MediaBox or perform redaction.

03 · Original recovery test

Hidden from view. Still present in the file.

We generated a harmless PDF with red markers outside the intended crop. After cropping, those markers disappeared from the rendered view. Resetting CropBox to MediaBox made the same markers visible again.

Original test PDF with red outside-content markers visible
01 · OriginalMediaBox = CropBox

Outer markers are visible.

Cropped test PDF with outside-content markers hidden
02 · CroppedCropBox moved inward

Outer markers are clipped from view.

Restored test PDF with outside-content markers visible again
03 · RestoredCropBox reset to MediaBox

The original markers return.

MediaBox unchanged

All three samples kept the same MediaBox after cropping.

Content still extractable

pdftotext still found the synthetic outside marker in every cropped sample, even though the normal cropped render hid it.

Restored render matched

Resetting CropBox produced a first-page render with SSIM 1.0 against the original for all three samples.

04 · Measured results

Cropping did not make these files smaller

Each cropped file became slightly larger because saving a changed page dictionary added serialization overhead while leaving the original content and resources intact.

SampleStateBytesMediaBox (pt)CropBox x, y, w×h (pt)
PDF-TEXTOriginal1.3 KB612×7920, 0, 612×792
PDF-TEXTCropped1.4 KB612×79255.08, 63.36, 501.84×665.28
PDF-TEXTRestored1.3 KB612×7920, 0, 612×792
PDF-IMAGEOriginal48.3 KB595.28×841.890, 0, 595.28×841.89
PDF-IMAGECropped48.3 KB595.28×841.8959.53, 75.77, 476.22×690.35
PDF-IMAGERestored48.3 KB595.28×841.890, 0, 595.28×841.89
PDF-MULTIOriginal2.4 KB612×7920, 0, 612×792
PDF-MULTICropped2.5 KB612×79248.96, 55.44, 514.08×681.12
PDF-MULTIRestored2.4 KB612×7920, 0, 612×792

Method: Three project-owned PDFs—text, embedded image, and mixed page sizes—were cropped using the same getCropBox()/setCropBox() operation as Doruni. Boxes were cross-checked with pdfinfo -box; visibility was rendered with Poppler; text presence was checked with pdftotext.

05 · Pick the right operation

Cropping, redaction, deletion, and compression are different jobs

Change the visible or printed areaCropping / CropBoxDoruni supports this
Permanently remove sensitive informationVerified redaction or secure removalNot supported
Reduce file bytesCompression and resource optimizationNot supported by Crop PDF
Resize the physical page and transform contentPage resize / content transformationNot supported
Use CropBox for
  • Removing white margins from the normal view
  • Focusing a page on the relevant visual area
  • Preparing a display or print framing choice
Do not use CropBox for
  • Hiding personal or confidential information
  • Deleting contract terms or annotations
  • Guaranteeing a smaller PDF file
06 · Verification checklist

How to inspect a cropped PDF

  1. 01

    Open it in more than one viewer

    Viewers and print workflows can interpret page boundaries differently. Confirm the visible result where the file will actually be used.

  2. 02

    Check the boxes, not only the screenshot

    Technical users can run pdfinfo -box file.pdf and compare MediaBox with CropBox.

  3. 03

    Treat sensitive material as still present

    If information must be unrecoverable, use a verified redaction workflow and inspect the final output independently.

Primary references

Definitions checked against the PDF reference

Change the view

Crop a PDF in your browser

Doruni changes the visible page area locally. Your file is not uploaded—but the operation is cropping, not redaction or compression.

Open Crop PDF