Back to all articles
PDF Tools7 min read

How PDF Compression Works: Downsampling & Vector Paths

Published on June 19, 2026

Portable Document Format (PDF) files are the standard for publishing documents, but they can quickly grow too large for email attachments and web downloads. PDF compression solves this by optimizing images, fonts, and internal data streams. Let's explore how PDF compression works under the hood.

1. The Object Structure of a PDF

A PDF is a structured database of objects: text blocks, vector graphics, embedded images, font metrics, and page layouts. These components are linked in a cross-reference table (xref) at the end of the file. Compression reduces the size of these individual objects without breaking the document's structure.

2. Image Downsampling & JPEG Compression

Embedded high-resolution images are the primary cause of bloated PDF files. Compression optimizes these assets using two main techniques:

  • Downsampling: Reducing the pixel resolution of images (e.g., from 300 DPI to a web-friendly 150 DPI).
  • JPEG Compression: Applying lossy compression to reduce file size while maintaining readability.

3. FlateDecode Stream Optimization

Text structures, page layouts, and vector coordinates are stored in data streams within the PDF. The specification compresses these streams using the FlateDecode filter, which uses the lossless Deflate algorithm (combining LZ77 and Huffman coding) to compress text data.

4. Font Subsetting & Metadata Cleanup

PDFs often embed entire font families to ensure the document displays correctly on all systems. Font subsetting strips out all unused characters, embedding only the characters used in the document text.

Additionally, compression cleans up XML metadata, print settings, and thumbnail previews that are no longer needed.

5. Client-Side PDF Optimization Advantages

Traditional tools upload PDFs to server-side engines for processing, posing privacy risks for sensitive documents. Client-side tools like ParthaTools compress PDFs directly in your browser using JavaScript libraries (like pdf-lib), ensuring your files never leave your device.

Frequently Asked Questions