What is PDF Compression and How Does It Work?
Students, job applicants and professionals regularly hit upload errors like "File size exceeds 2 MB" on recruitment and university portals. PDF compression is the engineering process of reducing a document's storage footprint while preserving visual fidelity and textual readability.
A Portable Document Format (PDF) file is not a single flat image; it is an object-oriented container containing text content streams, vector graphics, embedded raster photos, font tables, and metadata dictionaries. PDF compression optimizes each internal subsystem independently: downsampling raster photography, deflating content streams with zlib/FlateDecode, subsetting fonts, and discarding orphaned historical revisions.
The Four Pillars of PDF Compression
Raster Image Downsampling (DPI Optimization)
Embedded photos and page scans are a common cause of oversized PDFs. Scanners often capture pages at 300 or 600 DPI (Dots Per Inch) meant for offset printing. A modern compressor resamples these images down to 150 DPI (for office printing) or 72–96 DPI (for screen viewing), shrinking raw pixel counts by up to 75% without compromising legibility on standard displays.
Content Stream Deflation (FlateDecode)
Page layout commands, character placement matrices, and vector path definitions are written as plain text in the PDF specification. Using the industry-standard /FlateDecode filter (built on zlib DEFLATE), the compressor encodes repetitive character commands and layout whitespace into compact byte sequences losslessly.
Font Subsetting & Glyph Pruning
When documents are authored, Word processors frequently embed entire TrueType or OpenType font files (which can weigh 5 MB to 20 MB for complete Unicode scripts) to render just a few headings. Font subsetting inspects the document, keeps only the exact 50 or 100 character glyphs actually used in the text, and removes the remainder of the font binary.
Purging Incremental Updates & Metadata
Many PDF editors use "incremental saves", appending edits to the end of the file rather than rewriting the structure. Over time, deleted pages, old form field entries, and orphaned XRef tables linger invisibly. A clean compression pass rewrites the object hierarchy from scratch, discarding historical baggage and unwanted private metadata tags.
Lossy vs. Lossless PDF Compression
| Dimension | Lossless Compression | Lossy Compression |
|---|---|---|
| Primary Technique | FlateDecode, font subsetting, metadata stripping | Image resolution downsampling, JPEG re-quantization |
| Typical Size Effect | Depends on how the file was saved; often modest | Largest on scanned or photo-heavy files |
| Visual Impact | No visible change | Photos and scans soften as quality drops |
| Text & Vectors | Remains sharp vector typography | Unchanged when only images are recompressed; lost when whole pages are rasterized |
| Recommended Use Case | Archival legal contracts, architectural CAD schematics | Job applications, exam uploads (UPSC/SSC), email delivery |
Compress Your PDF to Any Target Size
TryDocsy provides a free, 100% private in-browser PDF compressor. Select target presets (such as 100 KB, 200 KB, or 500 KB) or use custom quality sliders without uploading your documents to any server.
It does not losslessly optimise your original file; instead, TryDocsy's compressor re-renders each page as a JPEG image at the quality you choose, so text in the result is no longer selectable.
Frequently Asked Questions
How does PDF compression make files smaller without destroying quality?
PDF compression targets three primary sources of bloat: high-resolution embedded images (which are downsampled to screen-friendly resolutions like 150 DPI), uncompressed data streams (which are packed using standard FlateDecode/DEFLATE algorithms), and redundant font tables (where complete multilingual font sets are trimmed to only the glyphs actually printed in the document). Vector text and geometry remain crisp and scalable.
What is the difference between lossy and lossless PDF compression?
Lossless PDF compression reorganizes internal object streams, strips unreferenced historical revisions, and applies lossless DEFLATE encoding. It changes no pixels, and how much it saves depends on how the file was written. Lossy PDF compression targets embedded raster images (like scanned pages and photos), reducing JPEG quality factors and downsampling resolution. It usually saves the most on scanned or photo-heavy files; a lossy pass that only touches images leaves vector text untouched.
Why do scanned PDFs become so much larger than native digital PDFs?
Digital PDFs created from Word or Google Docs contain lightweight vector instructions and embedded font glyphs (often only 50 KB to 200 KB for dozens of pages). In contrast, a flatbed scanner or phone scanning app captures full-page bitmap images at 300 DPI or higher. A 10-page document scanned at 300 DPI consists of 10 uncompressed or lightly compressed full-screen bitmaps, easily resulting in a 20 MB to 40 MB file.
How does TryDocsy compress PDFs without uploading files to a server?
TryDocsy uses WebAssembly and client-side JavaScript (@cantoo/pdf-lib and Mozilla pdfjs-dist) running entirely inside your local browser tab. The PDF binary is read into an ArrayBuffer in browser memory, where each page is rendered onto an HTML5 canvas and re-encoded as a JPEG image at the chosen quality before being assembled into a new PDF. Because every page becomes an image, text in the output is no longer selectable. No file bytes are sent over the network.

