Browser-based PDF editor with no backend. It lets users edit text content and reposition text blocks directly in the browser.
- Faithful page rendering through
pdf.json a<canvas> - Inline text editing with double-click activation
- Drag-and-drop text block repositioning
- Rotation-aware overlays and export for non-horizontal text
- Font-family detection for serif, sans-serif, and monospace styles
- Text color extraction from the original PDF drawing operators
- PDF export through
pdf-libthat hides original text and redraws modified content - Multi-page navigation inside the editor toolbar
- Fully client-side workflow with no file uploads to any server
Drop a PDF -> double-click text to edit -> drag text to move -> download the updated PDF
Node.js 18 or newer is required.
git clone https://github.com/gafapa/pdfedit.git
cd pdfedit
npm install
npm run devThe development server runs on http://localhost:5173.
npm run build
npm run preview| Path | Responsibility |
|---|---|
src/App.jsx |
Application entry flow, upload state, loading state, and error handling |
src/components/Dropzone.jsx |
File picker and drag-and-drop upload UI |
src/components/PDFEditor.jsx |
Page navigation, block mutation handlers, and export trigger |
src/components/PDFPage.jsx |
Page canvas rendering plus overlay composition |
src/components/TextBlock.jsx |
Individual text block drag and inline edit behavior |
src/utils/pdfParser.js |
pdf.js worker setup, text extraction, font parsing, and page rendering |
src/utils/pdfExporter.js |
pdf-lib export pipeline and standard-font mapping |
- The user selects or drops a PDF file.
parsePDF()loads the document withpdf.js, using a bundled local worker, then extracts text blocks, font hints, rotation, and text colors before preparing per-page view state.renderPage()draws the selected page to a canvas.- React overlays each text block as an absolutely positioned editable layer on top of the canvas.
exportPDF()covers the original text with white rectangles and redraws only modified blocks into a downloadable PDF.
- PDF space uses a bottom-left origin and point units.
- Screen space uses a top-left origin and CSS pixels.
- Rendering and overlay placement use
SCALE = 1.5. - Drag updates are translated back into PDF coordinates before export.
- Parsed rotation is preserved in the overlay and in exported text.
- Export uses PDF standard fonts as the closest approximation to embedded source fonts.
- Password-protected PDFs may fail to load.
- Complex color spaces can degrade to a simpler RGB fallback during export.
- Architecture details:
ARCHITECTURE.md - Working conventions and repository rules:
RULES.md
MIT