Guide · PDF

How to flatten, resize and shrink a PDF

By NREX Group · Published · Sources last checked: · 8 min read
Drafted with AI assistance and checked against the sources listed at the end.

Illustration on a navy background: three page cards shrinking in size left to right joined by arrows, a stack of thin flat sheets above them, and two nested rectangles for a page box.

A PDF that is the wrong shape for its job usually fails in one of three ways: the fields in it still accept typing, the page is the wrong paper size, or the file is too big to send. Each has a different fix, and the fixes touch different parts of the file. This guide takes one generated six-page test file through the browser tools for each job and records what changed, so the choice can rest on numbers.

How compression works and what a merge drops is covered in the guide on PDFs without uploading. This one is about choosing between flatten, resize, page removal and compress-to-size, and in what order.

Three words, several meanings

Flatten. In forms, it means turning a field into fixed page content. The standard describes fields as widget annotations that carry an appearance stream, a small self-contained drawing of what the field looks like.[1] Flattening copies that drawing into the page and deletes the field. pdf-lib’s own example fills in fields and calls form.flatten()before saving.[3] The word is also used for removing live transparency, the opacity model defined in clause 11 of the standard.[1] Some people also say it when they mean “turn every page into a picture”. Only the first meaning is what the Flatten PDF tool does.

Resize. Either the paper size (what the Resize PDF tool changes) or the file size (a different job). A page’s visible region is its CropBox if it has one, and its size is counted in units of 1/72 inch unless the page sets a UserUnit.[1]

Shrink. Fewer bytes, by dropping content, by re-encoding images or by drawing pages as pictures. The Compress PDF to Size tool does the last of these when a lossless rewrite is not enough.

One file, six tools

The test file has six A4 pages. Pages 1 to 5 each hold a synthetic 1600 × 1200 JPEG (428 to 480 KB) and a line of text; page 1 also has three filled text fields, a ticked checkbox and a link. It is 2,318,061 bytes. Each row below ran the site’s own code on it, and the text was read back with PDF.js.[4]

The same file after each tool (bytes). Field values count how many of the 3 typed values appear in the page text.
StepSizePagesField values in textFillable fieldsLinks
Original2,318,06160 of 341
Flatten PDF2,316,32963 of 301
Resize PDF to A52,319,52760 of 341
Remove pages 2 and 3 (plain unlink)2,318,06540 of 341
PDF Page Remover, pages 2 and 31,365,80640 of 341
Organize PDF, reversed order2,316,99660 of 301

Three readings. Flattening is a structural change: the values moved from annotations into the page text and the fields went to zero, but the photos are the bulk of the file, so the size barely moved. Resizing touched the page boxes and content scale, and the fields stayed. In our test, the Organize PDF row shows a fields count of 0 while four widget annotations remain on the page. We did not inspect why.

Where the bytes go when pages are removed

A page tree and a file are different things. In the plain test, two pages were unlinked and the file was saved: 2,318,065 bytes, four bytes more than before, because both photos were still in the file with nothing showing them. The PDF Page Remover tool follows that with a sweep of objects that nothing reaches, and its report counted nine dropped objects. The result was 1,365,806 bytes, 41.1% smaller, close to the two photos (950,198 bytes) that left.

If a PDF does not get smaller after deleting pages, check for this first: a bare unlink, as in the plain pdf-lib call, leaves the objects in the file. The Organize PDF tool is the right one when the aim is order rather than size, and the table above shows its trade-off for forms.

Order of operations for a size limit

Compress to Size searches for the highest JPEG quality that fits across all pages together, at 150 DPI first and then lower. The test used its search steps in a headless browser, with a limit of 1 MB (1,048,576 bytes).

Compress to Size on the test file (bytes). Every run stopped at 150 DPI.
SequenceResultJPEG qualityPages
Compress 2,318,061 to 1 MB945,8380.8646
Compress the same file to 2 MB1,335,1390.926
Remove pages 2 and 3, then compress to 1 MB808,7600.924
Compress to 1 MB, then remove pages 2 and 3577,1170.8644

Two things stand out. Even with a 2 MB limit the file was redrawn as pictures, because the lossless rewrite cannot get 2.32 MB under 2 MB when the photos are already JPEG. And the order matters for quality. Removing first left a file under the limit at the top of the quality range; compressing first spread the limit over six pages, two of which were then deleted.

Resize: what each paper size does to A4 content

Resize scales the whole page to fit the new size and centres it. The named sizes below are Ghostscript’s table, in points.[2] Scales were computed with the tool’s fit function for an A4 page of 595 × 842 points.

A4 content fitted to other sizes. The band is the empty margin on the side that has one.
TargetPointsMillimetresContent scaleEmpty band
A6297 × 420105 × 14849.9%none
A5420 × 595148 × 21070.6%none
A3842 × 1191297 × 420141.4%none
US Letter612 × 792216 × 27994.1%9.2 mm left and right
Legal612 × 1008216 × 356102.9%25.0 mm top and bottom
Tabloid (11 × 17)792 × 1224279 × 432133.1%18.2 mm top and bottom

The ISO sizes halve or double cleanly, so A4 to A5 or A3 leaves no band, while the American sizes have a different shape and leave one. Scale also decides type size: 11-point text becomes about 7.8 points on A5, which is worth checking on the first page.

Pulling the photos out instead

When the images are the problem, Extract Image from PDF offers a different route: get the pictures, shrink them with an image tool, and rebuild. In the test it found all five photos and each extracted file was byte-identical to the JPEG that went in, 2,310,748 bytes in total. Nothing is recompressed on the way out, so any quality loss comes from the step you choose next.

Questions

Which comes first: removing pages or compressing to a size?

In the test file, removing two pages first and then compressing to 1 MB kept JPEG quality at 0.92 for the four pages left. Compressing first picked 0.864 for all six pages, and removing pages afterwards left a 577 KB file, well under the limit. Removing first spent the size budget on fewer pages.

Do I need to flatten a form before compressing it to a size?

Not for the typed values to survive. When the pages are drawn to images, the values showed in the picture with and without flattening (1,441 dark pixels in the first field in both cases). What goes is the text and the fillable fields, because the result is a set of pictures.[4]

Does resizing a PDF make the file smaller?

Not in the test: A4 to A5 changed 2,318,061 bytes to 2,319,527. Resizing scales how the page is drawn and leaves the stored images alone, so it changes the paper size, not the bytes.

Why did one page removal change nothing in the file size?

A plain page removal in pdf-lib unlinks the page, and the saved file still held its photo: removing two pages left 2,318,065 bytes. The page remover tool also deletes objects nothing points to, which gave 1,365,806 bytes.

Are images pulled out of a PDF recompressed?

For the five JPEG photos in the test file, the extracted files were byte-identical to the JPEGs that went in. Other image types may need decoding first, so that result applies to JPEG streams stored as they are.

Is flattening the same as printing to PDF?

No. Flattening here moves each field’s stored look into the page and deletes the field. Printing to PDF asks another program to draw the page again, and what it keeps depends on that program.

Sources

Every link below was opened and checked on November 14, 2026. The measurements were made for this guide on a generated test file; real documents will give other sizes, and the raw output is kept with the scripts.

  1. ISO 32000-1:2008 (PDF 1.7), Adobe’s public copy. Appearance streams (12.5.5), widget annotations (12.5.6.19), interactive forms (12.7), the annotation Hidden flag, the CropBox definition, UserUnit (Table 30) and the transparent imaging model (clause 11). Accessed November 14, 2026.
  2. Ghostscript documentation, Using Ghostscript (paper sizes known to Ghostscript). The table of named paper sizes in inches, millimetres and points, used for the page sizes below. Accessed November 14, 2026.
  3. pdf-lib. The library’s Flatten Form example, which fills fields and calls form.flatten() before saving. Accessed November 14, 2026.
  4. PDF.js (Mozilla). The renderer and text reader used for the checks in this guide. Accessed November 14, 2026.