DEV Community

1436941541
1436941541

Posted on

I built a privacy-first PDF dark mode converter that runs entirely in your browser

TL;DR: I shipped pdfdark.org — a browser-side PDF dark mode converter. Files don't get

uploaded; the entire conversion happens in your browser via PDF.js + a Web Worker. Open source (MIT), free, no signup.

Why I built this

Reading long PDFs at night was killing my eyes. The two paths I had both sucked:

  1. Existing "dark mode PDF" web tools → required uploading the file. For research papers, contracts, medical records

— that felt sketchy. No way to verify what they did with my data.

  1. OS-level "invert colors" → wrecked photos and charts. Faces became X-rays. Graphs became noise.

So I built one with two non-negotiable defaults:

  • Nothing leaves your browser. PDF.js parses the file, a Web Worker does the dark-mode pass, pdf-lib stitches the

result. Verify it yourself in DevTools → Network.

  • Images keep their original colors. A saturation classifier detects photos and figures and leaves them untouched

while it darkens text and UI.

How it works

Drop PDF

→ PDF.js renders pages to canvas

→ Web Worker classifies each pixel by saturation

├─ saturated pixels (images, charts) → preserved

└─ low-saturation pixels (text, UI) → themed

→ pdf-lib assembles a new PDF

→ User downloads

The classifier runs on OffscreenCanvas inside a Web Worker, so the UI thread never blocks on large PDFs.

Output is a real PDF (image-based, one JPEG per page), so the dark mode persists when you email it, sync it to iPad, or

open it on a Kindle. Not a viewer toggle.

What it cost to ship

  • Domain: $7.50 (Cloudflare Registrar, .org)

  • Hosting: $0 (Vercel free tier)

  • Email forwarding: $0 (Cloudflare Email Routing)

  • Error monitoring: $0 (Sentry free tier, errors only with full content masking)

  • Time: a few weekends

Total cost: $7.50.

What I'm watching

  • Whether the "no-upload" angle resonates beyond privacy nerds

  • Edge cases that break the algorithm (weird embedded fonts, scanned PDFs)

  • Whether to add a vector-preserving mode for text-only PDFs (current output is image-based, so text isn't selectable)

Links

Top comments (0)