DEV Community

Cover image for Why I built a Zero-Server PDF Editor with React & pdf-lib (and skipped WASM)
Sidharth Krishnakumar
Sidharth Krishnakumar

Posted on

Why I built a Zero-Server PDF Editor with React & pdf-lib (and skipped WASM)

The Privacy Bottleneck
Merging tax documents or signing contracts often forces a compromise: convenience vs. security. Standard free tools require uploading sensitive data to remote cloud servers, leading to potential data persistence and server log exposure.

The objective: Zero data leakage. Files must never leave the local device.

Engineering Decisions: Browser RAM vs. 500MB PDFs
The common architectural choice for browser-side manipulation is WebAssembly (WASM). However, WASM introduces specific friction:

Large Bundle Sizes: Shipping full C++ or Rust binaries to the client adds overhead.

Initialization Latency: Significant delays occur while the engine boots.

Utilizing pure JavaScript via the pdf-lib library offers a more lightweight alternative, provided the state management is handled with precision.

The Technical Stack: Web Workers & ArrayBuffers
To maintain a responsive UI and prevent main-thread freezing, heavy operations offload to a Web Worker.

Transferable Objects: Utilizing ArrayBuffers ensures data moves between threads without the memory overhead of cloning.

Coordinate Mapping: Custom logic handles signature placement, ensuring visual fidelity regardless of the document’s original scale or orientation.

Outcome
A 100% serverless, ad-free utility. Data remains local. Processing occurs in milliseconds. No paywalls, no file-size limits, and zero external data calls.

Live Deployment: https://pdfstudio-steel.vercel.app/

Working on improvements and feature additions, any suggestions are welcome!

Top comments (0)