Skip to content

Guide

What actually makes a PDF smaller (and what does not)

By Vishnu KumarPublished 5 min read

"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:

Usual causes of a large PDF
ContentTypical share of a large fileWhat reduces it
Scanned pages and photosNearly all of itLower resolution, JPEG quality, bilevel compression for text scans
Embedded fontsLarge in short documents with many fontsSubsetting: embed only the glyphs used
Vector graphics from design toolsLarge when every point is keptSimplify paths at the source
Duplicated resourcesLarge in merged filesDeduplicating identical images and fonts
Structure, metadata, thumbnailsSmallObject 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.

Resolution to aim for
UsePixels per inchNotes
Reading on screen, email attachments150Sharp on laptops and phones
Quick previews72 to 100Fine for photos; small text gets soft
Office printing200 to 300300 for small text and fine detail
Professional print300 at final sizeAsk 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
Result of each preset on an 8.9 MB four-page scan
PresetImage resolutionOutput sizeChange
Original300 dpi8.9 MB
/printer300 dpi8.9 MBSlightly larger
/ebook150 dpi2.5 MB72% smaller
/screen72 dpi2.1 MB76% smaller
/ebook plus greyscale conversion150 dpi4.1 MBLarger 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.pdf

On 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 -list and pdffonts.
  • 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.