How hoehermann/pypdf_strreplace works
PyPDF Text Search and Replace is a command-line tool for inspecting and editing text in PDF content streams, with an optional GUI for examining operations. The main workflow reads pages, builds per-page font context, extracts searchable text, schedules and applies replacements or deletions, then writes the modified PDF. Font encoding and optional TrueType font support underpin edits; the debug UI is a separate optional capability. Relationships are based on the README and shown source; unsampled implementation details are not inferred.
Main entry points: main.py CLI and page loop · context.py Page font context · content.py Stream text processing · operations.py PDF text operations
Components 13
PDF workflow
- CLI and page loop
pypdf_strreplace/main.py - PyPDF reader/writer
Text processing
- Stream text processing
pypdf_strreplace/content.py - PDF text operations
pypdf_strreplace/operations.py - Edit actions
pypdf_strreplace/changes.py
Font handling
- Page font context
pypdf_strreplace/context.py - Font codecs
pypdf_strreplace/codec.py - TrueType font repository
pypdf_strreplace/font.py
Debug interface
- Debug setup and display
pypdf_strreplace/debug.py - Operation tree UI
pypdf_strreplace/gui.py
Other components
- User
- PDF input
- Modified PDF
Connections 14
- User → CLI and page loop: runs
README.md - PDF input → CLI and page loop: provides input
pypdf_strreplace/main.py - CLI and page loop → PyPDF reader/writer: reads and writes
pypdf_strreplace/main.py - CLI and page loop → Page font context: builds context
pypdf_strreplace/main.py - Page font context → Font codecs: creates codecs
pypdf_strreplace/context.py - CLI and page loop → Stream text processing: processes contents
pypdf_strreplace/main.py - Stream text processing → PDF text operations: builds operations
pypdf_strreplace/content.py - PDF text operations → Page font context: uses context
pypdf_strreplace/operations.py - Stream text processing → Edit actions: applies changes
pypdf_strreplace/content.py - CLI and page loop → TrueType font repository: loads optional fonts
pypdf_strreplace/main.py - Page font context → TrueType font repository: gets font widths
pypdf_strreplace/context.py - CLI and page loop → Debug setup and display: initializes optionally
pypdf_strreplace/main.py - Debug setup and display → Operation tree UI: creates interface
pypdf_strreplace/debug.py - PyPDF reader/writer → Modified PDF: writes result