« All posts

Why a Student Built a Browser PDF Editing Engine From Scratch

A developer built a from-scratch browser PDF editing engine after discovering no JS library truly edits PDFs, solving rendering, saving, and text grouping.

A developer spent roughly 14 months building an in-browser PDF editing engine after discovering that existing JavaScript libraries like pdf.js and jsPDF only support viewing or generating PDFs, not editing existing content. The core problem: PDFs store raw text and coordinates without any structural grouping, making reliable text editing far harder than it appears.

The build went through distinct phases: about seven months to get rendering solid across various font encodings and compression schemes, followed by early editing support, then a difficult period fixing corrupted saves. The hardest challenge was textbox recognition — grouping scattered text fragments into coherent editable blocks — which required manually annotating textboxes across many sample PDFs to derive general rules, taking around two months to solve.

The resulting engine now supports direct text editing, redaction, annotations, form filling, page reorganization, and metadata editing, alongside a JavaScript engine capable enough to run DOOM. For engineers, the project is a reminder that the PDF spec, despite being ubiquitous, remains poorly served by browser-native tooling, and that reverse-engineering document internals often exposes gaps invisible from the API surface.