I'm the maker of PDFToolsHub, a set of free PDF tools (merge, split, compress, rotate, protect and more) in English, Arabic and French. The one design rule: files are processed in your browser and never uploaded.
That sentence is easy to write and surprisingly hard to live up to. Here are the parts that took real work, and the places where I had to be honest about limits.
The stack
- Next.js 16 (App Router), React 19, MUI
- pdf-lib for reading and writing PDFs (merge, split, rotate, crop, watermark, page numbers...)
- pdf.js for page previews and rendering pages to PNG/JPG
- qpdf compiled to WebAssembly for encryption
- fflate for ZIP output
- Plain browser canvas for image work
There are no API routes at all. Files are read with file.arrayBuffer() and stay in memory.
"Never uploaded" should be checkable
I made a list of every network request the app makes: pages and scripts from my own origin, the pdf.js worker, the qpdf .wasm file (about 1.3 MB, downloaded only when you first use Protect/Encrypt), and fonts. Fonts are self-hosted at build time with next/font, so there's no runtime request to Google Fonts.
The one third-party request is Google Analytics, and only after a visitor clicks Accept in the cookie banner. None of these requests carry file content.
I'd rather say that plainly than claim "no tracking at all", which wouldn't be true.
Running qpdf in the browser
Password protection needs real encryption. pdf-lib doesn't encrypt, so I used qpdf (the C++ tool) compiled to WebAssembly. Protect PDF and Encrypt PDF both produce AES-256 (revision 6) in a PDF 1.7 file.
Two details that mattered:
- The npm package depends on Node's
fs, which doesn't exist in the browser. I stubbed it for browser bundles with a bundler alias. - qpdf writes to the console. Since command arguments can contain a password, I swap the console for a capturing one during each run, and a test checks that nothing derived from a password reaches it. Each job also gets a fresh qpdf instance.
Permissions are only requests
Encrypt PDF lets you set an owner password and toggle permissions (print, copy, edit, comment). It's tempting to market that as "prevent copying". It doesn't, and my own tests show why:
- pdf.js still extracts text where copying is "not allowed".
- qpdf can remove the restrictions without any password when there's no open password.
- With an open password, anyone who knows it can save an unrestricted copy.
So the page says it: permissions are advisory, and the only real protection is the open password (and its strength depends on the password you pick).
pdf-lib keeps data you thought you removed
This one surprised me. pdf-lib saves every object it parsed, including objects nothing refers to any more. So after "Delete pages", the deleted page's content could still sit in the saved file.
The fix is a reachability sweep: walk the object graph from the trailer and drop anything unreachable. Tests now check that deleted-page text is gone from the file bytes. There's an honest edge case: a link or bookmark that still points to a deleted page keeps that page reachable, and I documented it.
By the same logic, Crop PDF only changes the crop box, and covering text with an image doesn't remove what's underneath. None of these are redaction tools, and the pages say so.
Coordinates on rotated and cropped pages
Editing tools (add text, images, page numbers, highlights) work in the page's visual space, then convert to PDF coordinates, taking /Rotate and the crop box into account. Otherwise a watermark lands in the wrong corner on a rotated page. I verify this by rendering with pdf.js in tests and checking pixel positions.
Arabic and right-to-left
The site has English, Arabic and French. Arabic is where the interesting bugs live:
- A separate Emotion cache with
stylis-plugin-rtlmirrors the UI. - But PDF pages must not be mirrored: their coordinates are physical. I wrap previews and the page editor in an "LTR island" with a nested cache that doesn't flip.
- Numbers and file names inside Arabic sentences get Unicode LTR isolates (U+2066 to U+2069). Without them, "50 MB" renders as "MB 50".
- The page-range input accepts Arabic-Indic digits and the Arabic comma.
- Arabic search is normalized (alef variants, taa marbuta, diacritics, tatweel).
A script runs before every build and fails if any language is missing a message key or has mismatched {placeholders} (1,792 messages today), and the repo has 270+ tests on Node's built-in runner.
Limits I'd rather state than hide
- Add Text, Watermark and Page Numbers use standard Helvetica, so Latin characters only. Arabic, Cyrillic, Chinese and emoji are refused with an error instead of being drawn wrongly.
- Sign PDF places an image. It isn't a certificate-based digital signature.
- Compress PDF only re-encodes JPEG images; fonts, vectors and PNGs aren't optimized.
- pdf-lib and qpdf run on the main thread (only pdf.js uses a worker). The code yields between steps so progress bars repaint, but a very large file can still make the tab feel busy.
- Files are read whole into memory. I tested a 45 MB file in Node, but not browser memory limits, so the default cap is 50 MB per file.
What I'd like feedback on
- Has anyone moved pdf-lib work into a worker cleanly? That's my next big improvement.
- Better strategies for fonts beyond Latin in pdf-lib without huge bundles?
You can try the tools at pdftoolshub.net. I'm happy to answer questions about any of the above.