Guide
What actually makes a PDF smaller (and what does not)
"Compress PDF" tools all promise the same thing and deliver wildly different results, sometimes a bigger file. The reason is that a PDF is a container: what makes it large depends on what is inside. This guide shows where the bytes go, what each kind of compression actually changes, and measured results on a typical scanned document.
Where the bytes go
A PDF is a set of objects: page descriptions, fonts, images and metadata, most of them compressed streams. In almost every oversized PDF, one category dominates:
| Content | Typical share of a large file | What reduces it |
|---|---|---|
| Scanned pages and photos | Nearly all of it | Lower resolution, JPEG quality, bilevel compression for text scans |
| Embedded fonts | Large in short documents with many fonts | Subsetting: embed only the glyphs used |
| Vector graphics from design tools | Large when every point is kept | Simplify paths at the source |
| Duplicated resources | Large in merged files | Deduplicating identical images and fonts |
| Structure, metadata, thumbnails | Small | Object streams, removing thumbnails and unused objects |
Before compressing anything, find out which case you have. pdfimages -list file.pdf (from Poppler) lists every image with its pixel size, resolution and compression; pdffonts file.pdf lists fonts and whether they are subset.
Images: resolution matters more than anything
A phone photo of a page is often 3000 × 4000 pixels. Printed on A4 that is about 300 pixels per inch; on a screen, nobody can see beyond about 150. Halving the resolution in each direction removes three quarters of the pixels before any compression setting is touched.
| Use | Pixels per inch | Notes |
|---|---|---|
| Reading on screen, email attachments | 150 | Sharp on laptops and phones |
| Quick previews | 72 to 100 | Fine for photos; small text gets soft |
| Office printing | 200 to 300 | 300 for small text and fine detail |
| Professional print | 300 at final size | Ask the printer; do not downsample |
- Colour photos and greyscale scans compress best as JPEG at moderate quality; text edges start to blur below roughly quality 60.
- Black-and-white text scans should be bilevel (one bit per pixel) with CCITT Group 4 or JBIG2 compression, which is often ten times smaller than a greyscale JPEG of the same page.
- Screenshots and diagrams with flat colour should stay lossless (Flate, like PNG); JPEG adds visible smudges around text.
Measured: Ghostscript's presets on a scanned document
Ghostscript's pdfwrite device rewrites a whole PDF, downsampling and recompressing images according to a preset. We ran it on a synthetic four-page scan, 3000 × 4000 pixel JPEG pages at 300 dpi, 8.9 MB in total:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook \
-dNOPAUSE -dBATCH -dQUIET -sOutputFile=smaller.pdf input.pdf| Preset | Image resolution | Output size | Change |
|---|---|---|---|
| Original | 300 dpi | 8.9 MB | |
| /printer | 300 dpi | 8.9 MB | Slightly larger |
| /ebook | 150 dpi | 2.5 MB | 72% smaller |
| /screen | 72 dpi | 2.1 MB | 76% smaller |
| /ebook plus greyscale conversion | 150 dpi | 4.1 MB | Larger than /ebook alone |
Three lessons from that table. Downsampling did nearly all the work: /ebook and /screen differ by only 0.4 MB, so going below 150 dpi bought little and cost readability. The /printer preset kept the resolution and re-encoded the images, so the file did not shrink at all. And converting to greyscale, which many guides recommend, made this file bigger, because re-encoding changed the compression parameters. Always compare the output with the input; keep the original when compression does not help.
Re-encoding an image that is already JPEG loses quality a second time. Downsample once from the best source you have, and keep the original.
Fonts: subset, do not strip
A full CJK font can be several megabytes; a subset containing only the characters used on two pages is a few kilobytes. Most PDF producers subset by default (a font name like ABCDEF+NotoSans in pdffonts means it is subset). Ghostscript subsets as it rewrites.
Do not remove embedded fonts to save space. A PDF without its fonts is rendered with substitutes on other machines, which changes line breaks and breaks non-Latin text entirely; PDF/A archival formats require embedding for this reason.
Structure: small gains, lossless
PDF 1.5 introduced object streams and cross-reference streams, which pack many small objects into one compressed stream. qpdf applies them without touching any image or font, so the output is visually identical:
qpdf --object-streams=generate --compress-streams=y --recompress-flate \
--compression-level=9 input.pdf smaller.pdfOn a text-heavy PDF this typically saves a few percent to a few tens of percent; on a scan it saves almost nothing, because the images dominate. It is a good last step, not a first one.
- Merging the same logo or letterhead from many files can embed it many times; a rewrite with Ghostscript or a tool that deduplicates identical streams fixes that.
- Linearisation ("fast web view") reorders the file so the first page can display while the rest downloads. It does not make the file smaller, and slightly enlarges it.
- Removing page thumbnails, unused form fields and private application data (some editors embed their own editable copy of the document) can remove a surprising amount from files exported by design tools.
Scanning to a small PDF in the first place
- Scan text documents in black and white, or let the scanner app pick a document mode, rather than full colour.
- Crop to the page and straighten it: borders and table surface are pixels too.
- Run text recognition (OCR) so the PDF is searchable. The recognised text adds very little size and makes the file far more useful.
- Pick the resolution for the use: 150 to 200 dpi for reading and email, 300 for archival or reprinting.
PDF Craft does these steps on Android: edge detection, cropping and on-device text recognition when scanning, and compression and merging in the browser or on the phone, without uploading the files.
A checklist
- Find what is large first:
pdfimages -listandpdffonts. - Images: downsample to the resolution the reader needs, usually 150 ppi for screen.
- Text scans: bilevel with CCITT G4 or JBIG2.
- Fonts: keep them embedded, make sure they are subset.
- Structure: object streams with qpdf as a last, lossless step.
- Compare sizes and inspect the result; keep the original if the new file is not clearly better.
For the documents you produce yourself, the cheapest fix is at the source: export images at the right resolution, and in LaTeX or Typst include photos as compressed JPEGs rather than huge PNGs. See Typst vs LaTeX for the typesetting side.