How kwong012/pdftexteditor works
PDFTextEditor is a desktop and command-line tool for editing selectable text in PDFs while preserving its appearance. The main workflow is: open a PDF, select text, draft a replacement and preview it, add it to the change list, then export the edited PDF. The shared core locates targets, resolves drawing settings and applies replacements; font discovery supports matching the original typeface. GUI internals are only partially sampled, so some documented GUI-to-core wiring is shown at subsystem level.
Main entry points: pdf_edit_core.py Replace and redraw · pdf_editor_gui.py Desktop editor · edit_pdf.py CLI entry point · config.example.json Shared JSON config
Components 14
User interfaces
- Desktop editor
pdf_editor_gui.py - Preview and selection
pdf_editor_gui.py - Change list
pdf_editor_gui.py - CLI entry point
edit_pdf.py - Shared JSON config
config.example.json
PDF editing engine
- Target matching
pdf_edit_core.py - Replace and redraw
pdf_edit_core.py - Finalize PDF
pdf_edit_core.py
Font support
- Font resolution
pdf_edit_core.py - Font index and cache
pdf_edit_core.py
Other components
- User
- Source PDF
- Edited PDF
- System and user fonts
Connections 19
- User → Desktop editor: edits PDF
- Source PDF → Desktop editor: opens
- Desktop editor → Preview and selection: selects and drafts
- Preview and selection → Target matching: matches targets
- Preview and selection → Replace and redraw: builds preview
- Desktop editor → Change list: adds rules
- Change list → Replace and redraw: exports edits
- Desktop editor → Shared JSON config: imports or exports
- User → CLI entry point: runs command
- Shared JSON config → CLI entry point: configures
- CLI entry point → Source PDF: opens
- CLI entry point → Target matching: collects targets
- CLI entry point → Replace and redraw: applies targets
- Replace and redraw → Target matching: matches if needed
- Replace and redraw → Font resolution: resolves settings
- Font resolution → Font index and cache: looks up fonts
- Font index and cache → System and user fonts: scans font files
- Replace and redraw → Finalize PDF: finalizes document
- Finalize PDF → Edited PDF: writes