PDF cropping: CropBox, MediaBox and hidden content
Cropping a PDF changes the visible frame, not the file contents. How CropBox differs from MediaBox, why rotation flips margins, and why 20 MB stays 20 MB.
2026-12-02
MediaBox is the sheet, CropBox is the window
Every PDF page carries a MediaBox, the full physical page, and usually a CropBox, the part a viewer should show. A4 is 595.28 × 841.89 pt; at 1 pt = 1/72 inch that is 210 × 297 mm. Trimming 5 mm from each side means 14.17 pt per edge, taking A4 down to 566.9 × 813.5 pt.
A normal crop rewrites only the CropBox; the MediaBox and every content stream stay where they are. A viewer shows the intersection of the two boxes, and tools that ignore the CropBox show the full sheet. Some files also define BleedBox, TrimBox and ArtBox: print reads the TrimBox while a screen reads the CropBox, which is why the same file looks cropped on a monitor and uncropped at the printer.
Scanner borders and print bleed are different problems
A flatbed scan of a book usually brings 3–6 mm of grey lid, and a phone capture adds a dark edge plus perspective. For a reading copy, crop to the text block with about 2 mm of breathing room; for OCR, do not cut too tight, or ascenders and descenders disappear, so leave at least 3 pt beyond the last glyph.
For print, crop to the TrimBox and keep 3 mm (8.5 pt) of bleed on the outside, because the guillotine is not accurate to a tenth of a millimetre. Cropping a print-ready PDF all the way to the trim line without bleed produces a white sliver whenever the cut shifts. Crop marks normally sit in the bleed area, so crop inside them instead of deleting them by hand.
Rotation swaps which edge is which
A page can be displayed rotated by /Rotate 90, 180 or 270 without its coordinates changing. Crop values are read in unrotated user space: if a landscape page carries /Rotate 90, the top margin you see on screen is the left or right edge in the numbers the crop dialog reports.
The typical symptom is a cut on one side only: you set 10 mm at the top and the output loses 10 mm from the left. Check page rotation before typing numbers; when a batch mixes portrait pages with rotated landscape pages, apply the crop per orientation group rather than once for the whole file.
Why the file does not get smaller
A CropBox is a viewing instruction. The text, images, fonts and vector paths outside it remain in the content streams, so a 20 MB scan cropped to a quarter of the page is still around 20 MB. The only thing that shrinks is the page dictionary, by a few dozen bytes.
Real size reduction requires discarding content: rasterising the cropped area at a chosen DPI, which loses selectable text, or redacting the regions outside the box and running a sanitiser that drops unused objects. A 300 dpi colour A4 scan cropped to receipt size and saved as JPEG can fall from 18 MB to under 1 MB, but the result is an image, not a searchable document.
Page ranges, batching and checking the result
Crop the pages that need it, not the whole file: a 60-page report may contain two fold-out pages scanned at a different size, and applying the same box to all 60 cuts into the normal pages. Most tools accept ranges such as 1-3,7,12-15; verify the page count in the output before overwriting anything.
Open the result in at least two viewers, because support varies: pdf.js in browsers honours the CropBox, Adobe Acrobat usually does, while some lightweight previewers and print drivers fall back to the MediaBox. Check the first page, a rotated page and one from the middle, then print to PDF and look at the preview: if the old margins reappear there, the crop was never applied to that page.