Merging PDFs in the browser with pdf-lib (no server upload)
Most online PDF mergers upload your file to a server. For sensitive documents, that's a problem. Approach Use pdf-lib in the browser: Read files with File.arrayBuffer() PDFDocument.load() each source cop
Most online PDF mergers upload your file to a server. For sensitive documents, that's a problem.
Approach
Use pdf-lib in the browser:
- Read files with
File.arrayBuffer() -
PDFDocument.load()each source -
copyPages()into a newPDFDocument -
save()and download via a Blob URL
The PDF never needs to leave the user's device for this flow.
Verify privacy
Open DevTools → Network, merge a test PDF, and confirm there's no upload request carrying the file body. After the app loads, you can even try offline.
Try it
I packaged this (merge, split, and more) in PDFCraftify:
- Merge tool: https://pdfcraftify.com/merge-pdf
- Guide: https://pdfcraftify.com/guides/merge-pdf-without-uploading
Tradeoffs
- Browser memory limits very large jobs
- Password-protected PDFs must be unlocked first
- Not a replacement for full desktop DTP
If you build similar tools, what edge cases bite you most? Comments welcome.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.