Bhinish Dhiman
How to crop a PDF's margins, and why cropping hides rather than deletes
Add the PDF to the Crop PDF tool, type how many points to trim from the top, right, bottom and left (72 points to the inch, so 36 is half an inch), and download. The tool sets each page's CropBox, the area a reader displays. The MediaBox and everything outside the new boundary stay in the file, so cropping hides content and can never be used to redact it.
A scanner that leaves a grey border, a slide deck exported with wide white edges, a page that wastes a third of the screen on margin: cropping tidies all of these. What it does not do is remove anything from the page, and that fact decides whether cropping is the right job before you start.
Two boxes on every page
The MediaBox is the rectangle that sets a PDF page’s full extent; everything the page draws is placed inside it. The CropBox is a second, optional rectangle that tells a reader which part of the MediaBox to show and print. When a page has no CropBox, readers show the whole MediaBox.
Cropping a PDF means writing a CropBox. The tool’s crop function in src/lib/pdf/ops.ts reads each page’s MediaBox, subtracts your four margins and stores the result as the CropBox; the MediaBox itself is never changed. A test in the repository holds it to that: an A4 page cropped by 20 points on every side comes back with a CropBox 555 points wide and a MediaBox still 595 points wide.
Cropping a PDF in four steps
- Open Crop PDF and choose Add a PDF, or drop the file on the page. Each page appears as a thumbnail.
- Type a value into each of the four fields, Top, Right, Bottom and Left. They are in points and start at 20.
- Look over the thumbnails. The strip that will be hidden is shaded on every page. The shading is scaled as though each page were A4, so on US Letter or a widescreen slide treat it as a guide rather than a measurement.
- Press Crop PDF, then download the result. It keeps your file name with
-croppedadded.
If the margins on opposite sides add up to the whole width or height, the tool stops with “Those margins would leave nothing.” instead of producing an empty page.
Points, and what each margin leaves you
PDF measures in PostScript points, 72 to the inch, and the four fields use the same unit, so nothing is rounded on the way in. An A4 page is 595 by 842 points. The table converts four common margins applied equally on all sides: inches are the points divided by 72, millimetres are the inches multiplied by 25.4, and the visible area is 595 × 842 less twice the margin.
| Margin on each side | Inches | Millimetres | Visible A4 area (points) |
|---|---|---|---|
| 20 pt, the starting value | 0.28 | 7.1 | 555 × 802 |
| 28 pt | 0.39 | 9.9 | 539 × 786 |
| 36 pt | 0.5 | 12.7 | 523 × 770 |
| 72 pt | 1 | 25.4 | 451 × 698 |
So 28 points is the closest whole number to a centimetre, and 36 points takes half an inch off each edge.
The same four margins apply to every page. The page most likely to suffer is the one with a full-width table or figure, so find it in the thumbnails before you press the button. If one page needs a different crop, pull it out with Split PDF, crop it on its own and put it back with Merge PDF.
Cropping is not redaction
The content outside the CropBox is still in the file. Readers stop drawing it, but the page’s text, images and drawing instructions are untouched, and any text extractor will still find the words you trimmed away. Anyone can also reverse the crop by resetting the CropBox; this tool will do that for you if you set all four margins to 0. Treating a crop as a way to hide something has caused real disclosures.
| Cropping | Redaction | |
|---|---|---|
| What changes | The display boundary (CropBox) | The content itself |
| Is the text still there | Yes, and extractable | No |
| Reversible | Yes, by anyone | No |
| Right tool for hiding a name or a figure | No | Yes |
To take something out of a document, remove the page it sits on with Organise PDF, which builds a new file from the pages you keep, or rebuild the page from its source without it. Then test the result: run it through PDF to text and search for the words you meant to remove. If they come back, they are still in the file.
Two details that change what the margins mean
Margins are measured from the full page
Each run measures from the MediaBox, not from any CropBox the file already has. Cropping a cropped file therefore replaces the earlier crop rather than trimming further: to take another 10 points off a page you already cropped by 20, enter 30. A CropBox set by a scanner or another app before the file reached you is replaced in the same way.
The fields follow the page as stored
A page turned with a rotation value, which is how Rotate PDF saves a turn, is still stored the original way round, and its boxes are defined before the rotation is applied. On such a page the field labelled Top trims the stored top edge, which may display as a side. Cropping first and rotating afterwards avoids the mismatch, because the crop turns with the page.
Other ways to crop a PDF
On a Mac, Preview has Tools → Crop, which crops to a selection. Our tested notes do not establish whether it hides the trimmed area or removes it, so give its output the same text-extraction check before trusting it with anything sensitive. Windows has no built-in method we can point you to, and none of the command-line tools we have tested for these guides crops pages.
Checking the file stayed on your machine
Open your browser’s developer tools on the Network tab before adding the file. Adding the first file fetches the tool’s own PDF code, which is code arriving rather than your document leaving; nothing that follows sends a request containing your PDF. Or add the file, switch off Wi-Fi and run the crop: it works the same offline.
Trim the margins
Crop PDF trims every page at once and leaves everything under the margins recoverable, which is what you want for tidying and exactly what you do not want for hiding. If the real goal is to get rid of pages, use Organise PDF, and see what lossless PDF compression actually saves for why content you deleted can survive in a file that was only repacked.