DocuBlend is a zero-install, serverless document workspace built to solve the privacy and file-size headaches of online form submissions. By executing all logic directly in the user's browser, it allows individuals to drag in sensitive documents, merge PDFs, rearrange pages, and clean up images without ever uploading a single byte to an external server. The entire workflow is 100% private and capable of running completely offline.
Core features include interactive canvas composition, signature clean-up using color-key transparency, scanning perspective correction, and local background removal. Adaptive client-side compression helps users fit their documents exactly within strict portal limits (like a 2MB maximum) before downloading the final generated PDF.
100% Local Device Execution: Built the entire application logic to execute natively in the browser. Heavy operations like perspective correction (mapping a 4-point quad to a flat rectangle to straighten mobile photo scans) and AI background removal (via @imgly/background-removal) are processed locally on the client's device, ensuring sensitive documents never leave the machine.
Wasm Squoosh Compression: Integrated a custom browser-compatible package (a personal fork of Google's Squoosh) that exposes the Wasm codec binaries directly as a web dependency. This allows the app to programmatically quantize transparent PNGs (from background removal) to 64/256 colors using the oxipng codec entirely client-side, dramatically reducing the weight of embedded images without compromising document clarity.
Target-Size Optimization Search: Implemented a client-side binary search algorithm over JPEG compression levels. When users specify a target limit (e.g. 2MB), the engine dynamically adjusts the quality scale on the local canvas export until the generated PDF fits precisely under the threshold.
Offline-First Architecture: Leveraging react-konva for interactive manipulation and PDF.js (running in a Web Worker) for rendering PDF pages locally. The final PDF is compiled directly on-device using pdf-lib, making the application fast, highly secure, and completely independent of any server infrastructure.