When job seekers or students need to shrink a resume or certificate under a strict 100 KB or 200 KB upload limit, most online PDF compressors do two frustrating things:

  1. They upload private documents (resumes, Aadhaar/ID cards, bank statements, transcripts) to remote servers.
  2. They blindly rasterize every page into low-DPI JPEGs—which destroys selectable text, breaks clickable portfolio links, and causes Applicant Tracking Systems (ATS) to read a blank page.

While building PDFBlink—a free static suite of 21 PDF tools hosted on Cloudflare Pages—I wanted a compression pipeline that runs 100% inside the user's browser, keeps selectable text intact whenever possible, and never crashes mobile tabs.

Here is how the architecture works.

1. Zero-Upload Execution Inside Dedicated Web Workers

PDFBlink is a static Next.js export (output: "export"). There is no backend upload API at all—every PDF parse, compression pass, merge, split, and image conversion happens locally inside browser memory, which you can verify directly in Chrome DevTools → Network (0 upload requests).

To keep the UI responsive during heavy image decoding and rendering, compression runs inside a dedicated Web Worker (compression.worker.ts) using:

  • pdf-lib for structural inspection, object-stream compression, metadata stripping, and PDF reassembly.
  • Self-hosted Mozilla PDF.js (pdfjs-dist) WASM, CMaps, and standard fonts served locally from /pdfjs/ and /workers/ (no external CDN dependencies at runtime).
  • OffscreenCanvas inside the worker for re-encoding image XObjects and rendering bounded page bitmaps when required.

2. Two-Mode Compression: Quality-Preserving vs. Bounded Rasterization

Instead of one destructive slider, PDFBlink Compress PDF separates compression into two distinct modes (explained in detail in Lossless vs. Lossy PDF Compression):

Mode A: Quality-Preserving (ATS-Safe)

  1. Structural & Metadata Cleanup: Optionally deletes /Info dictionary entries (Title, Author, Creator, Producer) and XMP /Metadata streams while disabling automatic metadata regeneration on save, and writes compressed PDF object streams (useObjectStreams: true).
  2. Selective Image XObject Re-encoding: Walks indirect PDF objects looking for eligible /Subtype /Image streams (DCTDecode JPEGs and uncompressed RGB/Grayscale bitmaps, skipping masked/alpha images and N=4 CMYK ICC profiles to prevent color corruption).
  3. Byte-Budget Guard: Only replaces an embedded image stream if the re-encoded JPEG is genuinely smaller (< 96% of original bytes). Vector text, fonts, hyperlinks, forms, and bookmarks remain untouched.

In a live browser test on a 2-page 196 KB sample transcript with embedded graphics, Quality-Preserving mode reduced the file to 73 KB (62.7% smaller) while retaining selectable text.

Mode B: Bounded Rasterization (Strict KB Caps)

If a user targets a strict cap like Compress PDF to 100 KB or 200 KB on a heavy camera-scanned PDF where Quality-Preserving mode cannot reach the cap alone, PDFBlink—only when allowed—runs bounded rasterization iterations across resolution scale and JPEG quality until it meets the target or hits a readability floor (and warns clearly beforehand whenever rasterization will flatten selectable text, forms, or links, or invalidate digital signatures).

3. Mobile Browser Guardrails & Honest Pre-Flight Inspection

Browser PDF tools fail most often on smartphones when users drop a 60-page scan into an unguarded <canvas> loop. PDFBlink enforces explicit device-aware limits:

  • Desktop: up to 100 MB per file, 150 MB batch, 250 structural pages, 80 rasterization pages, 4096 × 4096 max canvas (16.7M pixels), and 90s timeout with AbortSignal cancellation.
  • Mobile / Low-RAM (<= 4 GB): up to 40 MB per file, 60 MB batch, 150 structural pages, 40 rasterization pages, and 2500 × 2500 max canvas (6.25M pixels).

Before processing, a magic-byte and structure validator checks for spoofed extensions, encrypted PDFs (/Encrypt dictionary, cleanly rejected rather than attempting password bypass), and digital signatures, AcroForms, hyperlinks, and bookmarks—surfacing upfront warnings before any bytes are changed.

Try It & Inspect the Network Tab Yourself

You can test the compression pipeline, Merge PDF Without Login, PDF Metadata Viewer, or any of the 21 tools at https://pdfblink.pages.dev/—and open your browser's Network tab while processing to verify zero uploads leave your device.

If you run into tricky real-world PDFs (CMYK scans, weird XObjects, or strict portal limits), I'd love to hear about them!