How ashishcherian15/pdf-refactor works
PDF-Refactor is a FastAPI application for inspecting PDFs, previewing configured edits, and processing batches into ZIP downloads. The main workflow accepts PDFs and edit settings, applies removal, theme, and watermark operations, then returns processed files. The README is empty and the UI source was not sampled, so the graph reflects the API and engine code shown; preview rendering and PDF inspection are also included.
Main entry points: main.py FastAPI endpoints · watermark_engine.py Single PDF processor
Components 18
API and input
- FastAPI endpoints
main.py - Config builder
main.py - PDF inspection
main.py
PDF processing
- Batch processor
watermark_engine.py - Single PDF processor
watermark_engine.py - Text removal
watermark_engine.py - Vector removal
watermark_engine.py - Eraser boxes
watermark_engine.py - Page theming
watermark_engine.py - Watermarking
watermark_engine.py
Previews and results
- Preview rendering
main.py - ZIP archive
watermark_engine.py
Other components
- User
- HTTP client
- PyMuPDF
- Processed download
- PNG preview
- Page count
Connections 26
- HTTP client → FastAPI endpoints: submits PDFs
- FastAPI endpoints → Config builder: builds settings
- FastAPI endpoints → PDF inspection: dispatches inspection
- PDF inspection → PyMuPDF: opens PDF
- PDF inspection → Page count: returns count
- FastAPI endpoints → Batch processor: dispatches batch
- Batch processor → Single PDF processor: processes each PDF
- Single PDF processor → Text removal: strips strings
- Single PDF processor → Vector removal: strips vectors
- Single PDF processor → Eraser boxes: applies boxes
- Single PDF processor → Page theming: applies theme
- Single PDF processor → Watermarking: adds watermark
- Text removal → PyMuPDF: redacts text
- Vector removal → PyMuPDF: redacts drawings
- Eraser boxes → PyMuPDF: redacts regions
- Page theming → PyMuPDF: draws page
- Watermarking → PyMuPDF: inserts marks
- Single PDF processor → PyMuPDF: saves PDF
- Batch processor → ZIP archive: writes PDFs
- ZIP archive → FastAPI endpoints: returns ZIP bytes
- FastAPI endpoints → Processed download: streams ZIP
- HTTP client → FastAPI endpoints: requests preview
- FastAPI endpoints → Single PDF processor: processes preview PDF
- FastAPI endpoints → Preview rendering: renders processed page
- Preview rendering → PyMuPDF: renders page
- Preview rendering → PNG preview: returns PNG