Inside the PDF Object Tree
A Portable Document Format file is a structured hierarchical tree of indirect objects: catalog dictionaries, page nodes, content streams, font subsets, XObjects (embedded images), and cross-reference tables (XREF).
The Three Mechanics of PDF Compression
1. FlateDecode Stream Compression (Lossless)
Text streams, vector coordinate instructions, and page layout operators are compressed using zlib / DEFLATE algorithms. Uncompressed PostScript-like drawing commands shrink by 60–80% without losing any precision.
2. Embedded Image Downsampling (Lossy)
Images represent over 90% of a PDF's total byte count. Standard scanners embed uncompressed or high-bitrate JPEG streams at 300–600 DPI. Client-side PDF compression engines extract image XObjects, redraw them onto HTML5 canvases at 150 DPI (for office printing) or 72 DPI (for web view), and re-encode them as optimized JPEGs before replacing the stream.
3. Object Pruning & XREF Sanitization
When a PDF is edited multiple times in desktop software, deleted objects and orphaned metadata remain in the file trailer. Compaction purges unused object dictionaries and rebuilds a dense, contiguous cross-reference table.