How I Built a 100% Client-Side PDF Powerhouse with WebAssembly and React (Zero Cloud Uploads)
Why Does Every Online PDF Tool Want Your Credit Card and Your Tax Returns? Earlier this month, I had to upload a signed certificate to a government application portal. The portal had one strict requirement: "Uploaded P
Why Does Every Online PDF Tool Want Your Credit Card and Your Tax Returns?
Earlier this month, I had to upload a signed certificate to a government application portal. The portal had one strict requirement:
"Uploaded PDF must be strictly below 100 KB."
I did what everyone does: searched "compress PDF under 100kb" on Google.
Every single top result was a multi-million-dollar SaaS product that:
Forced me to upload a sensitive personal document to an undisclosed remote server.
Compressed it to 125 KB (still rejected by the portal!).
Locked the "Extreme Compression" slider behind a $12/month subscription.
Or hit me with: "You have reached your free daily quota of 2 files. Enter your credit card."
I got frustrated enough that I decided to see how far we could push modern web browser primitivesβWebAssembly, HTML5 Canvas, Web Workers, and pdf-libβto build a completely private, zero-server alternative.
That experiment became PDFCraft
(Source on GitHub
).
Here is the technical breakdown of how we achieved 100% client-side PDF manipulation with zero cloud leaks.
- The Core Architecture: Zero-Cloud Processing
Traditional PDF websites use server-side Python/C++ pipelines (e.g., Poppler, Ghostscript, or LibreOffice in Docker containers). That architecture has major drawbacks:
Massive Server Costs: Running headless PDF engines across millions of files costs thousands in server bills.
Privacy Risks: Uploading legal contracts, tax documents, and medical scans creates massive GDPR and compliance liabilities.
Instead, PDFCraft operates entirely on the client device:
User Device (Local Memory)
βββ File Input (Drag & Drop)
β βββ ArrayBuffer / Blob in Local Memory
βββ Local Processing Engines
β βββ pdf-lib (Vector streams, page tree manipulation, e-signatures)
β βββ HTML5 Canvas (Quantization, resolution scaling, image crunching)
β βββ Web Workers (Off-main-thread compute without freezing the UI)
βββ Instant Download
βββ Direct Blob URL (0 bytes transmitted to any backend)
- The Target Size Squeezer: Hitting Exact 100KB/200KB Ceilings
Standard compressors just say "Low, Medium, High". But portal upload bots don't care about "High"βthey care about β€ 95 KB or β€ 195 KB.
To guarantee that a PDF always comes in under the portal limit:
Binary Stream Extraction: We extract embedded page streams and rasterize page canvases at high DPI.
Dynamic Binary Search Quantization: Instead of guessing a single JPEG quality factor, our algorithm runs an in-memory binary search across resolution scale and quantization factors:
It tests quality brackets (e.g. 0.85 -> 0.65 -> 0.45) in milliseconds.
If the generated PDF stream exceeds the target ceiling (say, 95 KB), it immediately downscales background image coordinates while preserving vector text edge sharpness.
Iterative Verification: The final byte buffer is measured before download. If it's 94.2 KB, it is delivered immediately.
- Zero-Account E-Signing (ESIGN Compliant)
Instead of forcing users to sign up for DocuSign or Adobe Sign just to put an initials stamp on a 2-page lease, we implemented an in-browser vector signature pad:
Signatures are captured via HTML5 Canvas with cubic BΓ©zier curve smoothing for natural pen strokes.
The vector paths are converted directly into clean PNG byte streams and embedded into the PDF page tree using pdf-lib's drawImage and drawText.
The entire signing session happens offlineβeven with airplane mode turned on!
- 60-Second ATS Resume Studio
Most online resume builders let you design your resume for 30 minutes, only to hit you with a paywall modal at the download step.
PDFCraft includes a built-in ATS Resume Studio that:
Formats single-page vector PDF resumes compatible with applicant tracking systems (Workday, Greenhouse, Lever).
Includes a local keyword scanner that compares your resume against any job description in real-time.
Exports directly as clean, uncompressed vector text that machine parsers can read with 100% accuracy.
- What We Learned
Modern browser engines (V8, WebAssembly, Web Workers) are powerful enough to replace 90% of cloud utilities. You don't need a heavy backend server to compress a PDF, sign an agreement, or extract spreadsheet tables.
π Live Web App: https://pdf-craft-vert.vercel.app/
π¦ Open Source Repository: https://github.com/Vishnu-cod/pdf-craft
I'd love to hear feedback from the developer community! What utilities would you like to see built into the client-side suite next?
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.