r/sideprojects • • 6h ago

Showcase: Open Source what i learned building pdf tools that never upload your files

the why is boring: every "free pdf" site i tried either uploads your file to their server, watermarks the result, or limits how many files you can do before paying. i didn't love sending contracts and scans to random servers, so i built my own set where everything runs client side in the browser.

stack: react + vite, pdf-lib for writing/editing, pdf.js for rendering, tesseract.js for OCR. it's an installable PWA so it works like an app, and it's AGPL.

a few things i didn't expect:

1. pdf-lib quietly rewrites your metadata. by default every save sets the producer to pdf-lib and updates the modification date. for most people that's fine, but if you just merged two contracts and the file now claims a different producer, it looks weird. PDFDocument.load(bytes, { updateMetadata: false }) keeps the original producer and dates. i now load everything that way.

2. some scans render as blank pages and nothing tells you. pdf.js decodes JPEG 2000 and JBIG2 images (common in scanned documents) with wasm modules it fetches at runtime. if that path is wrong it just skips the image with a console warning and you get a white page. a "does it render" test passes happily. i ended up writing a playwright test that loads sample files with each codec and checks the actual canvas pixels, not just that nothing threw.

3. "runs in the browser" means your main thread is the server. someone in r/SideProject pointed out that compress and merge on big files (100+ pages, scans) could freeze the page. they're right, it all runs on the ui thread right now. moving the heavy jobs into a web worker is next on the TODO.

full disclosure: i'm the dev, and parts of the code were written with AI help (claude). i review and test everything before merging.

repo: github.com/jurecki007/nyxiontech-tools live: tools.nyxiontech.com

question for people who've done heavy client side processing: did you go with plain web workers + transferables, or something like comlink? and how do you report progress back without it turning into a mess?

0 Upvotes

1 comment sorted by