We built a private PDF text editing SDK on top of PDF.js — here’s the story

15 阅读1分钟

Implementing truly usable PDF text editing in the browser turned out to be much harder than we expected.

Over the past months, we’ve been working on a project called ElasticPDF. The original motivation was simple: most existing PDF editors either rely heavily on backend services or make text editing feel like manually adjusting coordinates rather than actually editing text.

We wanted something that:

  • runs entirely in the browser
  • never uploads PDF files
  • still feels close to editing text in Word

We chose PDF.js as the foundation, but quickly realized that rendering PDFs is the easy part — editing existing text objects is where things get messy.

Some of the hardest problems we ran into:

  • Editing existing PDF text instead of overlaying fake text layers
  • Keeping text layout stable without manually tweaking coordinates
  • Handling multilingual input, especially Chinese, Japanese, and Korean
  • Editing rotated text (90°, 180°, or arbitrary angles)
  • Making the experience visual instead of coordinate-based

To address these, we ended up building a pure frontend PDF text editing SDK that:

  • Lets you add, delete, and modify existing PDF text
  • Supports multilingual text (including CJK)

Editing Multilingual Colored Text.gif

  • Automatically reflows text to avoid overflow and misalignment Zoom, Move, Rotate Entire Text.gif

  • Supports rotated text editing

edit-rotated-text.gif

  • Works with no backend at all

Over time, we also added annotation tools (highlight, underline, pen, signatures) and basic page management, since most real-world PDFs need more than just text edits.

highlight-and-reply.gif

The result is a cross-platform, framework-agnostic SDK that can be embedded into web apps with a single frontend codebase, while keeping all PDF data local and private.

This project is still evolving, but it’s been a deep dive into how PDFs actually work under the hood — and how far frontend-only solutions can go.

If anyone’s curious, we put together a demo and more details here: www.elasticpdf.com

Happy to answer questions or discuss PDF internals with anyone interested.