All posts

Open Source

I built PDF tools that still work with your Wi-Fi off

By Vivek Bhange4 min read

Cover image for I built PDF tools that still work with your Wi-Fi off

The point in two sentences

The PDFs people merge, compress and unlock online are usually the private ones: bank statements, payslips, contracts, ID scans. I built Private PDF, fifteen free PDF tools that do all the work inside your browser tab, so the file never leaves your device.

Why this bothered me

Search “compress PDF” and the top results all work the same way. You choose a file, it uploads to their server, the server does the work, and you download the result. The sites usually say files are deleted after an hour or so. Maybe they are. You can’t check.

That is a lot of trust to hand over for a job your own laptop can do in a second. Browsers can now run real programs compiled to WebAssembly, and the open-source libraries for PDF work are mature. There is no technical reason for the upload any more.

What it does

Fifteen tools, each on its own page:

  • Organise: merge, split, rotate, remove pages, extract pages
  • Compress: three levels, from “no quality loss” to “smallest file”
  • Convert: JPG or PNG to PDF, PDF to JPG, PNG or plain text
  • Edit: page numbers and text watermarks
  • Security: add a password with AES-256 encryption, or remove one you know

No sign-up, no watermark on the output, and no daily limit. Your own device does the work, so it costs almost nothing to run.

How it works without a server

Three open-source projects do the heavy lifting, all running in the page:

  • pdf-lib handles anything that moves pages around or draws on them: merging, splitting, page numbers, watermarks, turning images into pages.
  • qpdf, a long-standing C++ PDF tool, compiled to WebAssembly and run in a background worker. It does what pdf-lib can’t: AES-256 encryption, removing passwords, and repacking a file more compactly.
  • Mozilla’s pdf.js, the engine behind Firefox’s PDF viewer, turns pages into images and pulls out text.

Compression was the interesting one. A PDF is mostly big because of photos and scans inside it, not text. So the tool finds the JPEG images in the file, re-saves them with the browser’s own image encoder at a sensible quality and resolution, and puts them back. Text, fonts and drawings are never touched, so they stay sharp and selectable. Then qpdf repacks the whole file. A test document full of photos went from 257 KB to 71 KB at the recommended setting. If nothing gets smaller, you get your original back rather than a pointlessly re-saved copy.

One small detail I’m pleased with: phone photos often store “rotate me” as a tag instead of actually being rotated. PDF viewers ignore that tag, which is why so many JPG-to-PDF tools give you sideways pages. Private PDF reads the tag and places the photo the right way up, without re-compressing it.

“Never uploaded” is easy to say, so here is how to check

Any website can claim it doesn’t upload your files. These are the ways you can check this one:

  1. Turn off your Wi-Fi. Load a tool, disconnect, then use it. It still works, because there is no server involved.
  2. The page is locked to itself. The site sends a Content Security Policy that only lets the page connect to its own address. In recent Chrome and Edge, a second header, Connection-Allowlist, blocks every other outbound connection too. Even a bug in my code couldn’t send your file somewhere else.
  3. Read the code. It is all on GitHub under the MIT licence.

What it deliberately doesn’t do

  • It doesn’t crack passwords. Unlock PDF removes a password you already know, for example from your own bank statements so you don’t have to type it every time. It is not for getting into files that aren’t yours.
  • Watermarks and page numbers use a built-in font, so they only support Latin characters for now.
  • Merging keeps pages but not extras like bookmarks or fillable form fields.

The same idea, again

While I was at it, I built a second tool on the same principle: Markdown Preview, a Markdown editor with live preview that handles tables, code, maths and diagrams and exports to HTML or PDF. Its share links need no server at all: the whole document is compressed into the part of the link after the #, which browsers never send anywhere.

More tools like these are coming. You can find them all on my free tools page.

What I’d do differently

I’d build the visual page organiser first: thumbnails you can drag to reorder, rotate and delete. Typing page ranges like “2, 5-7” works, but most people think in pictures, not numbers. It is first on the list for the next version, along with signing PDFs and making scanned documents searchable.

Try it

If a PDF comes out wrong, please open an issue. Odd files are the best way to make it better.

Enjoyed this?

Written by Vivek Bhange, Full-Stack AI Engineer. See his work or work with me.

Keep reading

Easter egg hunt

This site hides 16 surprises. Found ones stay found on this device. On a phone, type secret words into the command bar (the >_ button).

  1. RickrolledNot found yet

    Show hint

    My photo has a secret. Double-click it (on a phone, press and hold).

  2. Impatient clickerNot found yet

    Show hint

    Click anywhere, fast, about 25 times in a row.

  3. Agent of changeNot found yet

    Show hint

    Type the word that means "make it different".

  4. Gravity checkNot found yet

    Show hint

    Type my first name.

  5. Secret wordNot found yet

    Show hint

    Type something friendly, like "chai" or "namaste".

  6. HackerNot found yet

    Show hint

    Type what hackers do (four letters).

  7. The snapNot found yet

    Show hint

    Type the name of a purple villain who snaps.

  8. Sharp eyesNot found yet

    Show hint

    Something almost invisible floats on the screen. Find it and click it (desktop).

  9. Root accessNot found yet

    Show hint

    Open the command bar (press /, or tap >_ on a phone), then try to become root.

  10. Duck hunterNot found yet

    Show hint

    A rubber duck is hiding on the 3D island.

  11. World travellerNot found yet

    Show hint

    Visit all four views.

  12. Night owlNot found yet

    Show hint

    Come back between midnight and 4 a.m.

  13. Arcade regularNot found yet

    Show hint

    Play every quick game in the Arcade (the ones that open on the Arcade page).

  14. Chain reactorNot found yet

    Show hint

    Set off 30 bursts with a single move in Critical Mass.

  15. Last one standingNot found yet

    Show hint

    Win a match of Drop Zone.

  16. Code whizNot found yet

    Show hint

    Get 10 answers right in a row in Code Clash.

zsh — visitor@vivek: ~

Ask Vivek

Ask me anything. My work, how I run projects, or whether I'm a fit.

AI answers from this site's content. It can make mistakes.