Merge and compress PDFs in the browser with pdf-lib and PDF.js, without uploads
Many free PDF tools upload files to a server, which poses a privacy risk for sensitive documents like contracts or bank statements. Modern browsers can handle common PDF tasks such as merging and compressing locally, using the pdf-lib and PDF.js libraries without any backend. Merging is straightforward: each file's pages are copied into a new document and saved with object streams, which can reduce size by a few percent. Compression is limited, since lossless re-saving only helps text-heavy files, while shrinking scanned images requires lossy rasterization that flattens text into pixels. Developers must also handle password-protected files, user-controlled ordering, memory limits on low-end devices, and the fact that bookmarks are not preserved by default.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in