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:
- They upload private documents (resumes, Aadhaar/ID cards, bank statements, transcripts) to remote servers.
- 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-libfor 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). -
OffscreenCanvasinside 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)
- Structural & Metadata Cleanup: Optionally deletes
/Infodictionary entries (Title,Author,Creator,Producer) and XMP/Metadatastreams while disabling automatic metadata regeneration on save, and writes compressed PDF object streams (useObjectStreams: true). - Selective Image XObject Re-encoding: Walks indirect PDF objects looking for eligible
/Subtype /Imagestreams (DCTDecodeJPEGs and uncompressed RGB/Grayscale bitmaps, skipping masked/alpha images andN=4CMYK ICC profiles to prevent color corruption). - 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 MBper file,150 MBbatch,250structural pages,80rasterization pages,4096 × 4096max canvas (16.7Mpixels), and90stimeout withAbortSignalcancellation. - Mobile / Low-RAM (
<= 4 GB): up to40 MBper file,60 MBbatch,150structural pages,40rasterization pages, and2500 × 2500max canvas (6.25Mpixels).
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!