How I Built an In-Browser, Zero-Upload PDF Merger & Converter Using WebAssembly and Canvas
Whenever you search for a simple utility like "Merge PDF" or "Convert WebP to PNG" , you are usually greeted by the same frustrating experience: A 15MB file upload limit behind an aggressive paywall. A subscription pop-up asking for $12/month. Your sensitive personal documents (tax returns, signed contracts, medical records) getting uploaded to an untrusted remote server. As developers, we know…
In the digital age, users often encounter frustrating limitations when searching for basic utilities like merging PDFs or converting WebP images to PNG. A common experience involves a 15MB file upload cap, followed by a subscription prompt demanding $12 per month. Worries about sensitive documents, such as tax returns, contracts, or medical records, being transmitted to untrusted servers further compound the issue.
Developers know that modern browsers possess advanced hardware-accelerated GPUs, multi-threaded Web Workers, and WebAssembly capabilities. It becomes clear that there is no technical reason to upload documents to a cloud server merely to merge pages or alter image formats. Thus, the creation of SwiftUtils—a suite of entirely client-side, zero-upload web utilities—was born.
This innovative solution processes all tasks directly within browser memory. The technical architecture behind SwiftUtils' in-browser PDF merging process is as follows: 1. The mergePDFsInBrowser function accepts a fileList of PDF files. 2. Utilizing pdf-lib, a JavaScript library, the function creates a new document in browser memory.
3. For each file in the fileList, the function reads the file's array buffer and loads the PDF structure locally. 4. The PDF's page indices are then copied to the merged document, with each page added sequentially. 5. Once all pages are merged, the function saves the document and generates a local memory blob in PDF format. 6. Finally, the function returns a URL for the newly created PDF blob, eliminating any need for cloud-based uploads or subscriptions.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.