SimplexPDF
Local PDF toolkit: ten tools, twenty REST endpoints, no cloud upload
Source is not public. Demo on request.
SimplexPDF is a PDF toolkit — compress, merge, split, rotate, watermark, and more — that runs on its own server instead of a public cloud API, so files aren't sent to a third party. It covers ten tools through twenty REST endpoints; the source isn't public, but a live demo is available on request.
the problem
Compression is the one operation among the ten that's genuinely hard to get right: naive compressors either barely shrink the file or visibly wreck image quality, because generic Ghostscript presets don't distinguish a scanned text page from a photo page. The other nine tools are comparatively mechanical PyMuPDF page operations, but giving twenty endpoints one consistent job lifecycle — upload, poll, download, automatic cleanup — was its own scope of work.
how it is built
- Ten tools — compress, merge, split, rotate, extract pages, watermark, PDF-to-image, reorder pages, password protect/unlock, crop — behind exactly twenty REST endpoints, including four dedicated preview endpoints (thumbnail, page info, size estimate, before/after compare).
- Compression runs through Ghostscript with three hand-tuned tiers (Extreme / Balanced / Quality) that each set DPI, JPEG quality factor, color-encoding filter, chroma subsampling, and metadata/annotation stripping independently, rather than three presets on one quality slider.
- PassThroughJPEGImages and PassThroughJPXImages are explicitly disabled, because without that flag Ghostscript lets images that are already JPEG-encoded bypass every quality setting it's about to apply.
- AutoFilter mode lets Ghostscript choose JPEG for photo-like content and lossless Flate for text-like content per image rather than forcing one encoding across a document; monochrome scanned pages get CCITTFaxEncode, a lossless fax-style encoding built for exactly that content.
- Every other operation — merge, split, rotate, extract, watermark, PDF-to-image, reorder, protect, crop — runs through PyMuPDF rather than Ghostscript.
- A compression size estimate is computed and shown before the user commits to the slower, real compression pass.
- AES-256 password protection with a corresponding unlock path.
- Batch upload up to twenty files, background job processing per file, single-ZIP download for a batch, and an automatic 30-minute deletion sweep so nothing lingers on disk.
- Vanilla HTML/CSS/JS front end with Tailwind CSS for styling — no framework, no build step.
the hard parts
- Ghostscript's command-line argument order is load-bearing: -d/-s flags must precede -sOutputFile, which must precede the -c PostScript block, which must precede -f and the input path. Getting that wrong makes Ghostscript fail silently instead of erroring — the worst failure mode for a service that has to report a clean status back to a frontend that's polling it.
- JPEG quality isn't set through an ordinary command-line flag for this use case — it has to go through a PostScript setdistillerparams block, which behaves differently from the DPI and filter settings that are plain -d flags.
- Getting real compression instead of a placebo meant actively overriding Ghostscript's defaults: PassThrough has to be turned off or already-compressed images get copied through untouched, and AutoFilter has to be chosen deliberately per tier, or a document that's mostly scanned text gets the same treatment as one that's mostly photos and one of the two comes out wrong.
Need something like this built?
Backend systems, payment and API integrations, AI pipelines, and the interfaces in front of them. Freelance or contract, remote.