Why we do not promise to compress any PDF
A 2,999-byte text PDF grew 63 times when we rendered it to JPEG. What shrinks in a PDF, what stays the same, and why Compress PDF may say no.
The first compression experiment we ran, on 6 September 2026, produced this table row. A PDF with only text and vector drawings weighed 2,999 bytes. We rendered its page to a JPEG at 108 ppi and rebuilt a PDF from the picture. The new file was 190,282 bytes, about 63 times larger, and it had lost its selectable text.
On the same day a scan stored as PNG went from 1,846,177 bytes to 72,942, a saving of 96.05%. Both results come from the same method. That is why the Compress PDF page names the kinds of content it works on and says plainly when it found none.
What we tried
We ran two rounds on generated files. Nothing here comes from customer documents.
| Method | Text and vector | Photos and scans | Forms |
|---|---|---|---|
| Resave with pdf-lib object streams (6 Sep) | 36.9% smaller on a file without object streams, no change on an optimized one | No saving | No saving |
| Render every page to JPEG (6 Sep) | Grew 40 to 63 times, text lost | PNG scan 96.1% smaller, JPEG scan 33.6% smaller | Grew 46 times, field, text and page geometry lost |
| QPDF stream recompression (28 Sep) | No saving | 0% to 0.03% on photo reports, none on a full-page scan | 13.8% smaller |
| Replace embedded images only (28 Sep) | No saving | 97.6% on a JPEG photo report, 99.7% on a PNG one, 80.9% on a full-page scan | No saving |
The second round also had one PDF exported from LibreOffice: QPDF saved 27.2%, image replacement 25.3% and both together 27.3%. A file with transparency over text was left alone by both.
Three patterns come out of this table.
A file made of text and vector shapes has little left to compress once its structure is already packed. The 36.9% in the first row came from a fixture written without object streams; the same file, already optimized, saved nothing.
Pictures hold the bytes. In the 28 September round, almost every large saving came from replacing the images in the file, and most of it from lowering their resolution. The two 3000×2000 photos in the PNG report weighed 10.7 MB, and the file lost 99.7% when only those images were swapped.
Whole-page rendering is the wrong tool for ordinary documents. It deletes the text layer, breaks form fields and makes small files huge. It looks good only on a scan, and a scan has no text to lose.
What we chose
Compress PDF replaces only embedded images, then saves with object streams. A new image copy is kept only if it is smaller than 90% of the old one, and the whole result is kept only if it is smaller than the original. If not, the page says “This PDF is already compact — no smaller copy was made” and offers no download. We did not want a button that returns a bigger file with a green tick.
Two levels exist: Standard recompresses to JPEG quality 0.75 and Strong to 0.6, both at no more than 150 ppi of the size an image is drawn at. The target-size article covers how the target menu picks between them.
The result states what was left alone. The page counts images recompressed against images found and groups the skipped ones by reason: masks or transparency, too small to matter, an unsupported image format, too large to process, could not be re-encoded, already compact. A PDF without pictures gets a line saying so. We used the same words in every case so that a visitor can tell “nothing to do” from “something failed”.
There is a second, separate experimental tool for scans, Compress scan. It accepts only image-only pages, up to 8 MB and 4 pages. It asks for explicit consent to lossy compression, keeps the original, shows a before and after comparison in memory, and fails when it saves nothing. It will not rasterize a PDF that has text or interactive content.
What does not shrink, and what we refuse
- Text and vector pages, because there is no image to replace.
- Images with masks, CMYK, Indexed or Separation colour, images that are not 8-bit, images under 150×150 pixels or 50 KB, and images over 40 megapixels.
- Encrypted files, digitally signed or certified files, and files with incremental updates. A rewrite would break a signature, and our incremental check also refuses some unsigned files that were saved more than once.
- Anything over 60 MB or 200 pages.
What we could not verify
All the test files are generated, plus the one LibreOffice export. We did not measure memory or time on a phone with large image-heavy files. Real CMYK and 16-bit images and real signed PDFs are covered by unit tests only. We have not tested Firefox. We estimated that an optimized JPEG encoder such as MozJPEG would add another 5 to 15% at the same settings. We did not test that, and it would not change the result for text files.
How we measured
The first round is npm run trial:pdf-compression (scripts/pdf_compression_trial.mjs, 6 September 2026) with pdf-lib and PDF.js in Node. It compared byte counts, extracted text, page boxes, rotation, form values and rendered pixels at 144 ppi before and after. Pixel error was the mean absolute difference per RGB channel on a 0 to 255 scale. The second round is scripts/pdf_compression_trial_v2.mjs (28 September), with a vendored QPDF WASM build as method A. All methods kept extracted text, form fields, page boxes and rotation. Image replacement changed pixels only inside the replaced images, with a whole-page mean channel error of 4.8 or less. A browser smoke test, scripts/pdf_compress_smoke.mjs, runs the real processor in Chromium and WebKit on the same fixtures plus signed, encrypted, incremental and PNG-predictor files.
Try it
Compress PDF is in the Laboratory’s PDF tools. Try it on a PDF with photos, then on a text-only PDF, and compare the two result lines.