When we set out to build EditoraPDF, we had one clear goal: create a completely free, open-source PDF editor that respects user privacy and works entirely in the browser. No servers, no uploads, no tracking — just pure client-side processing.
This is the story of how we built it, the technical challenges we faced, and the decisions we made along the way. Whether you're a developer looking to build something similar or just curious about open-source development, this post will give you a complete inside look.
The Vision: Privacy-First PDF Editing
Most PDF editors today require you to upload your documents to their servers. For sensitive documents like contracts, medical records, or financial statements, this is a privacy nightmare.
We wanted to build something different:
- 100% client-side processing — files never leave your browser
- No installation required — works directly in web browsers
- No signup or tracking — completely anonymous usage
- Open source — transparent code anyone can audit
- Free forever — no paywalls or subscriptions
With these principles in mind, we started evaluating technologies that could make this vision a reality.
Choosing the Tech Stack
Frontend Framework: Next.js 14
We chose Next.js 14 with the new App Router for several reasons:
- Excellent SEO capabilities — server-side rendering and metadata management out of the box
- Static export support — deploy anywhere (Vercel, Netlify, GitHub Pages)
- TypeScript integration — type safety and better developer experience
- Performance optimization — automatic code splitting, image optimization
- Developer experience — hot reload, great documentation, huge ecosystem
PDF Rendering: PDF.js
PDF.js by Mozilla is the gold standard for rendering PDFs in the browser. It's what powers Firefox's built-in PDF viewer.
Key advantages:
- Battle-tested in millions of browsers
- Excellent rendering quality
- Text extraction capabilities
- Canvas-based rendering for performance
- Active maintenance by Mozilla
PDF Manipulation: pdf-lib
For creating and modifying PDFs, we use pdf-lib — a pure JavaScript library that runs entirely in the browser.
Key capabilities:
- Create PDFs from scratch
- Modify existing PDFs (add pages, rotate, delete)
- Embed text, images, and shapes
- Copy pages between documents
- Zero dependencies on Node.js
State Management: Zustand
Instead of Redux, we chose Zustand — a minimal, fast state management library.
- Simple API — no boilerplate code
- TypeScript-first design
- Small bundle size (~1KB)
- No context providers needed
Styling: Tailwind CSS
Tailwind CSS gives us utility-first styling with excellent developer experience and small production bundles through automatic purging.
Architecture & Design Decisions
1. Client-Side Processing Only
Everything happens in the browser:
User uploads PDF ↓ PDF.js parses and renders to canvas ↓ User makes edits (text, images, shapes) ↓ pdf-lib creates new PDF with changes ↓ Download to user's device
At no point does the file leave the user's device. This is true privacy by design.
2. Normalized Coordinate System
One major challenge: PDFs have different page sizes, and users can zoom in/out. How do we track overlay positions?
Solution: Normalize all coordinates to the range [0, 1].
// Instead of absolute pixels:
{ x: 150, y: 200 }
// We store normalized coordinates:
{ x: 0.25, y: 0.33 }
// Then scale to current viewport:
actualX = normalizedX * pageWidth * zoom
actualY = normalizedY * pageHeight * zoomThis makes overlays zoom-independent and portable across different page sizes.
3. Component Architecture
We structured the app into focused components:
PdfViewer— main canvas renderingThumbnails— page navigation sidebarToolbar— zoom, rotate, delete controlsEditToolbar— tool selection (text, image, shape)AdvancedOverlayLayer— text, images, shapes renderingExportButton— PDF export logic
4. State Management Pattern
Our Zustand store maintains:
{
originalFile: File,
pages: [
{
id: string,
originalIndex: number,
rotation: 0 | 90 | 180 | 270,
deleted: boolean,
textOverlays: [],
imageOverlays: [],
shapeOverlays: []
}
],
selectedPageId: string,
zoom: number,
editMode: 'select' | 'text' | 'image' | 'shape'
}Technical Challenges We Faced
Challenge 1: Text Extraction Accuracy
PDF.js can extract text, but positioning isn't always pixel-perfect due to how PDFs encode text (sometimes as individual characters, sometimes as words).
Solution: We extract text items with their transformation matrices and convert to normalized coordinates with generous bounding boxes.
Challenge 2: Performance with Large PDFs
Rendering 100+ page PDFs can freeze the browser.
Solution:
- Lazy load pages (only render visible pages)
- Use requestAnimationFrame for smooth rendering
- Recommend 25MB / 50 pages limit
- Offscreen canvas for thumbnails
Challenge 3: Export Quality
Embedding text and images in pdf-lib requires careful coordinate transformation from browser space to PDF space.
Solution: Build a comprehensive transformation pipeline that handles:
- Page rotations
- Coordinate system differences (Y-axis flipped in PDF)
- Font embedding and sizing
- Image format conversion
Challenge 4: Browser Compatibility
Different browsers have slightly different canvas implementations and PDF rendering quirks.
Solution: Extensive testing across Chrome, Firefox, Safari, and Edge. Use feature detection instead of browser detection.
Why We Made It Open Source
From day one, we knew this had to be open source:
1. Transparency = Trust
When dealing with sensitive documents, users need to verify that files truly stay local. Open source lets anyone audit the code.
2. Community Contributions
Open source enables developers worldwide to contribute features, fix bugs, and improve the tool.
3. Learning Resource
We learned so much from open-source projects. Now we can give back and help others learn Next.js, PDF processing, and web development.
4. Longevity
Even if we stop maintaining it, the community can fork and continue development. The tool lives on.
The Results
After months of development, we launched EditoraPDF with:
The codebase is available at github.com/affsquadDevs/editorapdf under the MIT License.
Key Takeaways for Developers
- ✓Client-side processing is powerful — Modern browsers can handle complex tasks that used to require servers
- ✓Choose the right libraries — PDF.js and pdf-lib saved us months of development
- ✓Coordinate normalization is key — Makes overlays portable and zoom-independent
- ✓Performance matters — Lazy loading and optimization are crucial for large files
- ✓Open source benefits everyone — Transparency, community, and learning all win
Get Involved
EditoraPDF is an open-source project, and we welcome contributions from developers of all skill levels.
Frequently Asked Questions
What technology stack is EditoraPDF built with?
EditoraPDF is built with Next.js 14, TypeScript, React 18, PDF.js for rendering, pdf-lib for manipulation, Zustand for state management, and Tailwind CSS for styling. It is completely open source under MIT license.
Why did you choose Next.js for a PDF editor?
Next.js provides excellent performance, SEO capabilities, static export support, and great developer experience. The App Router makes it easy to build fast, SEO-friendly applications that can be deployed anywhere.
Is EditoraPDF really open source?
Yes, EditoraPDF is 100% open source under the MIT License. The complete source code is available on GitHub at github.com/affsquadDevs/editorapdf
How does client-side PDF processing work?
PDF.js renders PDFs to HTML canvas in the browser, while pdf-lib manipulates the PDF structure. All processing happens locally in the user's browser using JavaScript, ensuring complete privacy and security without any server uploads.
Can I use EditoraPDF code in my own project?
Absolutely! EditoraPDF is licensed under MIT, which means you can use, modify, and distribute the code freely, even in commercial projects. Just include the original license notice.
How can I contribute to the project?
Check out our Contributing Guide on GitHub. You can contribute code, report bugs, suggest features, improve documentation, or help with testing.
Final Thoughts
Building EditoraPDF was a challenging but rewarding journey. We learned immense amounts about PDF processing, browser capabilities, and open-source development.
The best part? Anyone can now take this code, learn from it, modify it, or build something even better. That's the power of open source.
If you're working on a similar project or just curious about the code, check out the GitHub repository. We'd love to hear your feedback, answer questions, or review your pull requests.