Why is my PDF so big, and how much can it shrink?
Photos and scans make most PDFs big. In our tests, the Balanced setting cut a 5.78 MB photo file to 324.9 KB and a 3.17 MB scan to 809.7 KB. Text-only files barely change. The two print settings keep photos at full size, so they save almost nothing and can even make a file bigger.
Does compressing a PDF reduce quality?
It can. Maximum Compression shrinks photos to about 72 pixels per inch and Balanced to about 150. In our test, one photo went from 2480 x 1754 pixels to 1122 x 793 on Balanced. Before you replace the original, open the copy and zoom into a photo and a line of small text. The loss cannot be undone.
Why did my PDF get bigger after compressing?
Usually because you picked a print setting. Quality Focused and Print production embed any fonts the original only named, so the file carries extra font data. Under Quality Focused our 17.6 KB text file grew by 15.1%. If the result shows a negative saving, keep your original and try Balanced or Maximum Compression.
Can I compress a password-protected or signed PDF?
Not while it needs a password to open. Unlock it first, compress the copy, then add the password again. A signed PDF can be compressed, but the digital signature is removed completely. Send the signed original when the signature matters.
What each compression level does
Every level runs the same Ghostscript rewrite and changes only the -dPDFSETTINGS preset. The rest of the command is fixed: -sDEVICE=pdfwrite, -dCompatibilityLevel=1.4, -dDetectDuplicateImages=true, -dCompressFonts=true and -dSubsetFonts=true. The preset decides the target image resolution and whether fonts that the original only names (without embedding them) get embedded.
The last column shows what happened to one 2480 x 1754 pixel photo that sat on an A4 page at 332 pixels per inch (ppi). Quality Focused and Print production left it at full size; at 332 ppi it was only slightly above their 300 ppi target.
| Level on this page | Preset flag | Image target | Same photo after the rewrite |
|---|---|---|---|
| Maximum Compression | /screen |
72 ppi | 538 x 380 px |
| Balanced (default) | /ebook |
150 ppi | 1122 x 793 px |
| Quality Focused | /printer |
300 ppi | 2480 x 1754 px, unchanged |
| Print production | /prepress |
300 ppi | 2480 x 1754 px, unchanged |
The Balanced command, with file names shortened
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages=true -dCompressFonts=true -dSubsetFonts=true -sOutputFile=output.pdf input.pdf
Measured sizes on three kinds of PDF
We compressed three test files with each level. The photo file has four A4 pages, each carrying one large camera-style JPEG. The text file has ten pages of body text in Helvetica, which the original references but does not embed. The scan file has three A4 pages, each a 300 ppi grayscale JPEG with no text layer, the way many office scanners save documents.
Percentages are calculated the same way the result page shows them: bytes saved divided by the original size. A negative figure means the output is larger than the upload.
| Sample | Original | Maximum Compression | Balanced | Quality Focused | Print production |
|---|---|---|---|---|---|
| Photo pages, 4 pages | 5.78 MB | 97.8 KB (98.3%) | 324.9 KB (94.5%) | 5.78 MB (-0.1%) | 5.78 MB (0.0%) |
| Body text, 10 pages | 17.6 KB | 11.4 KB (35.4%) | 11.3 KB (35.9%) | 20.2 KB (-15.1%) | 17.0 KB (3.4%) |
| Grayscale scan, 3 pages | 3.17 MB | 298.6 KB (90.8%) | 809.7 KB (75.1%) | 3.17 MB (0.2%) | 3.17 MB (0.2%) |
Grayscale option and processing time
Ticking Convert to grayscale together with Balanced took the photo file from 324.9 KB to 270.7 KB and the scan from 809.7 KB to 706.9 KB. Colour is gone for good in that copy, so keep the original if anyone may need it.
Each run on these test files finished in under 10 seconds on a laptop. The server stops a run after 300 seconds, so very long image-heavy documents may need splitting first.
Why a compressed file can come out bigger
The text sample grew by 15.1% under Quality Focused. Before the rewrite, pdffonts listed Helvetica and Helvetica-Bold as not embedded: the file relied on the reader to supply them. The /printer and /prepress presets embed every font, so Ghostscript added subsets of its own Helvetica-compatible fonts. The file now looks the same on every device, but it carries font data it did not have before.
Images that are already at or below the preset target are not reduced. They are still decoded and written out again, along with every page description, so the output can land a few bytes either side of the original. That is what happened to the photo file under Quality Focused.
If the result shows a negative saving, keep your original. For text-heavy documents, Balanced or Maximum Compression usually gives the smaller file because neither embeds missing standard fonts.
What else changes in the compressed copy
Compression does not edit your PDF in place. Ghostscript reads the pages and writes a new document, and some things do not survive that trip.
- Digital signatures are removed, not just invalidated. A signed test file that pdfsig reported as valid came back with no signature at all.
- In our test, bookmarks and web links were kept, but a fillable text field was dropped.
- Maximum Compression and Balanced stored the grayscale scan as three-channel RGB images. With the grayscale option ticked, the pages stayed single-channel gray.
- The output is PDF 1.4 and its Producer field reads GPL Ghostscript with the version number.
- Clear document information fields blanks Title, Author, Subject, Keywords and Creator. In our test Ghostscript also wrote matching empty values into the XMP metadata stream.
- A PDF that needs a password to open cannot be compressed. Unlock it first, compress it, then add the password again.
Reading the result page
The result shows the original size, the new size, the bytes saved and the percentage. The download is named after your file with _optimized added, and the status page and download link stop working 24 hours after upload. Open the compressed copy and zoom into a photo and a line of small text before you replace the original, because image quality loss at 72 or 150 ppi is not reversible.
Last updated . How these figures were produced: we built synthetic sample PDFs with TCPDF and ran the exact Ghostscript 10.08 command this compressor builds for each level, then read image sizes with Poppler pdfimages, fonts with pdffonts and signatures with pdfsig. Your own files will give different numbers.