What is PDF Compression and How Does It Work?
PDF compression is the engineering process of reducing a Portable Document Format file's byte size by downsampling embedded raster images, deflating content streams, subsetting font tables, and stripping unreferenced objects so documents load faster and satisfy strict portal upload limits without destroying visual readability.
A PDF is not a flat image. It is an object-oriented database structured around a cross-reference table and an object hierarchy. A single document incorporates independent subsystems: vector drawing instructions, character placement operators, embedded TrueType or OpenType font programs, raster pixel bitmaps, and metadata dictionaries. PDF compression targets each subsystem with dedicated optimization algorithms rather than applying a single uniform file compressor.
Four Core Technical Mechanisms of PDF Compression
Raster Image Downsampling and Re-encoding
Embedded photos, figures, and scanned pages routinely account for 75% to 90% of total document byte count. Hardware scanners often capture documents at 300 to 600 DPI (Dots Per Inch) designed for physical printing. Compressors downsample these image grids to 100 to 150 DPI for web and screen use, and re-quantize the Discrete Cosine Transform (DCT) coefficients in JPEG streams, discarding high-frequency visual details invisible on computer monitors.
Stream Deflation via /FlateDecode
Page layout commands, character coordinates, and vector path definitions are stored as plain text content streams in the PDF standard. Compressors apply the standard /FlateDecode filter (built on the zlib DEFLATE algorithm, RFC 1951). This identifies repeating strings and coordinates, replacing them with sliding-window dictionary references losslessly without changing a single pixel or vector path.
Font Subsetting and Glyph Pruning
When documents are authored in Word or InDesign, authoring engines often embed full TrueType or OpenType font binaries to render a handful of headings. A multilingual Unicode font can weigh 2 MB to 15 MB. Font subsetting inspects the document, extracts only the exact character glyphs actually printed on the pages, builds a compact subset font dictionary with a unique subset tag prefix (such as ABCDEF+FontName), and deletes all unused glyph curves.
Purging Orphan Objects and Incremental Revisions
Many desktop PDF editors use incremental saves, appending edits and revised pages to the tail of the file rather than rebuilding the internal structure. Over months of editing, deleted pages, orphaned form fields, and superseded cross-reference tables remain trapped inside. A clean compression pass traverses the object tree from the root catalog, purges unreferenced objects, and serializes the document into packed object streams (/ObjStm).
PDF Compression Standards Reference Table
Source: PDF ISO 32000-2:2020 ("Document management - Portable document format - Part 2: PDF 2.0", ISO, accessed 2026-10-29).
| Optimization Area | ISO Clause / Reference | Primary Filter / Technique | Quality and Usability Impact |
|---|---|---|---|
| Raster Bitmaps | Clause 7.4.4 & Clause 8.9 | /DCTDecode (JPEG), downsampling DPI | Lossy: slight softening on photos, vector text stays intact |
| Layout Streams | Clause 7.4.4.4 | /FlateDecode (zlib DEFLATE) | 100% Lossless: zero change to rendering or layout |
| Font Programs | Clause 9.6 & Clause 9.7 | Font Subsetting (glyph pruning) | Lossless: printed characters stay sharp vector outlines |
| Object Structure | Clause 7.5.7 & Clause 7.5.8 | Object Streams (/ObjStm), XRef stream | Lossless: discards deleted pages and revision baggage |
| Canvas Rasterization | HTML5 Canvas / pdfjs-dist | 1.4x scale (~100 DPI) JPEG re-encoding | Lossy: achieves strict KB limits; text is no longer selectable |
How TryDocsy's In-Browser PDF Compressor Works
Many online PDF compressors upload your sensitive tax documents, contracts, and transcripts to cloud servers for remote processing. TryDocsy processes everything client-side inside your browser tab without transmitting file bytes over the network.
To help users meet strict file size limits on university and government recruitment portals (such as 100 KB, 200 KB, or 500 KB limits), TryDocsy's PDF compressor uses Mozilla pdfjs-dist to render each page onto an HTML5 canvas at a fixed 1.4x scale factor (approximately 100 DPI). It then runs an 8-step binary quality search across JPEG compression quality factors to match your requested target size. Finally, it uses @cantoo/pdf-lib to assemble those JPEG images into a fresh PDF file.
Because every page is converted into a raster JPEG image, text in the compressed output is no longer selectable, searchable, or copyable. If your document requires selectable vector text, you should split out unneeded pages or flatten annotations rather than rasterizing.
Which PDF Tool Should You Use for Your Task?
Use when you must meet strict upload size limits (like 100 KB or 200 KB) for application forms and document text does not need to remain selectable.
Use when you need to seal form fields, checkboxes, and digital signatures permanently into the page layer while preserving vector text crispness.
Use when color stamps, logos, or scanned photos inflate file size and you can discard color channels to produce an 8-bit monochrome document.
Use when a document exceeds size limits because it includes extra pages you do not need. Extract only the required pages without re-encoding.
Lossy vs Lossless PDF Compression Comparison
| Dimension | Lossless Compression | Lossy Compression |
|---|---|---|
| Primary Technique | FlateDecode, font subsetting, orphan object pruning | Raster downsampling, JPEG quantization, page rasterization |
| Size Savings | Modest (10% to 30%), dependent on creator software | Large (50% to 90%), highest on scanned documents |
| Visual Quality | Identical to original document | Photos and scans soften depending on quality level |
| Text Selectability | Retained as selectable, copyable vector text | Lost when pages are rasterized into images |
| Recommended Use Case | Archival legal contracts, engineering drawings, publications | Job applications, exam uploads, email attachments |
Compress Your PDF Locally in Your Browser
TryDocsy provides a free client-side PDF compressor. Select target presets like 100 KB, 200 KB, or 500 KB without uploading files to any server.
Frequently Asked Questions
How does PDF compression reduce file size without ruining readability?
PDF compression targets three primary sources of file bloat: high-resolution embedded images, uncompressed layout streams, and redundant font glyph tables. Compressors downsample raster images from print-level resolutions (300 to 600 DPI) to display-friendly resolutions (100 to 150 DPI), pack text and layout commands using FlateDecode DEFLATE compression, and trim font dictionaries down to only the glyphs printed in the document. Vector shapes and text remain crisp and scalable.
Why does TryDocsy make text non-selectable during PDF compression?
TryDocsy's in-browser compressor operates by rendering each PDF page onto an HTML5 canvas at a 1.4x scale factor (roughly 100 DPI) and re-encoding it as a JPEG image through an 8-step quality search. This search aims to land files under strict size targets like 100 KB or 200 KB for government exam and recruitment portals. Because each page becomes a raster JPEG image inside the new PDF, the text can no longer be highlighted, searched, or copied.
What is the difference between lossy and lossless PDF compression?
Lossless PDF compression cleans up internal object streams, strips unreferenced historical save revisions, and applies FlateDecode dictionary encoding to content streams. It does not alter a single pixel or character outline. Lossy PDF compression resamples embedded raster photographs and applies JPEG quantization, discarding subtle color variations. Lossy passes produce significant size reductions on scanned documents, whereas lossless passes save modest amounts on text-heavy documents.
Why are scanned PDF documents so much larger than digital PDFs?
Digital documents exported from applications like Microsoft Word or Google Docs contain compact vector commands and font glyph matrices, often taking only 50 KB to 200 KB for dozens of pages. In contrast, a flatbed scanner or smartphone scanning app photographs each physical page as an uncompressed or lightly compressed bitmap image at 300 DPI or higher. A 10-page document scanned at 300 DPI contains 10 high-resolution photos, quickly bloating to 25 MB to 50 MB.
What is the FlateDecode filter in the PDF standard?
FlateDecode is the standard compression filter defined in Clause 7.4.4 of ISO 32000-2:2020. It uses the zlib DEFLATE algorithm (RFC 1951), combining LZ77 dictionary substitution with Huffman entropy coding. It compresses page description streams, drawing operators, and XML metadata losslessly by finding repeating patterns and replacing them with compact binary markers.
When should you split or flatten a PDF instead of compressing it?
If your file is oversized simply because it contains extra pages you do not need, using a PDF split tool to extract only the target pages reduces file size immediately without re-encoding or altering page content. If you have interactive form fields or annotations that need to be permanently sealed into the page content while preserving vector text sharpness, use a PDF flatten tool instead of a rasterizing compressor.

