TG Edit-Pdf
TG Edit-Pdf
Advertisement

How PDF Compression Works

PDF compression shrinks a file's size without changing what the document looks like to you. To understand why some PDFs collapse to a fraction of their size while others barely budge, you need to know what is actually taking up the space inside the file.

What makes a PDF large

A PDF is a container. Its size is the sum of everything packed inside it, and a few things dominate:

  • Embedded images and scans. This is the single biggest factor. A scanned document is not text at all — it is a full-page photograph of text. Each page might be a 200–300 DPI image weighing several megabytes. Ten scanned pages can easily be a 30 MB file.
  • High-resolution photos. Images dropped into a PDF are often stored at their original camera resolution, far more detail than a screen or printer needs.
  • Embedded fonts. PDFs embed the fonts they use so the document renders identically everywhere. A few subsetted fonts are small; a document carrying many full font families adds up.
  • Metadata, form fields, and duplicated objects. Usually minor, but they exist.

The rule of thumb: if your PDF is large, it is almost always because of images. Pure text and vector graphics are extraordinarily compact.

Lossless vs lossy compression

There are two fundamentally different ways to make data smaller.

Lossless compression finds redundancy and encodes it more efficiently, then reconstructs the original bytes exactly. The text layer, vector drawings, and font data in a PDF are already compressed losslessly (typically with Flate/zlib). You lose nothing — but you also can't squeeze much further, because that work is already done.

Lossy compression throws away information your eyes won't miss. JPEG is the classic example: it discards fine color and detail that are hard to perceive, trading a small drop in visual quality for a large drop in size. This is where the real savings in a PDF live, because images are the heavy part — and images tolerate lossy compression well.

Image downsampling and JPEG recompression

Effective PDF compression does two things to the embedded images:

  1. Downsampling. It reduces the pixel resolution of images that are stored at higher detail than the document needs. An image at 600 DPI looks identical to one at 150 DPI on screen, but holds four times as much data per inch. Dropping the resolution removes pixels you were never going to see.
  2. JPEG recompression. It re-encodes each image as a JPEG at a chosen quality level, discarding perceptual detail. Lower quality means a smaller file.

On /compress-pdf, this is the smart mode: images are recompressed and downsampled while the text stays real, selectable, and searchable. A quality setting controls how aggressive the trade-off is. There is also a rasterize mode, which flattens every page to a single JPEG image for maximum shrink — the catch is that the text becomes part of the picture and is no longer selectable.

Why text PDFs barely shrink

If you run a compressor on a PDF that is pure typed text — an exported report, an invoice, a contract — you will see almost no change. That is expected, not a failure.

Text in a PDF is stored as font glyphs and positioning instructions, already packed with lossless Flate compression. There is no perceptual detail to discard and no resolution to lower. A 200 KB text PDF is small because text is inherently small; there is simply nothing left to remove. Compression earns its keep on image-heavy and scanned documents, not on clean text.

A practical consequence: if a "text" PDF is somehow large, it is probably a scan in disguise — pages stored as images. Compressing the images helps; if you also need the words to be selectable, run it through OCR first.

Related tools

Try /compress-pdf to shrink an image-heavy document, or /pdf-to-images when you want to extract the embedded pictures directly.


Advertisement
Advertisement
Advertisement