A Windows desktop app that rasterizes PDFs into image-only PDFs to remove hidden text layers, metadata, and embedded prompt injection content.
Many PDFs can contain hidden prompt injection text, invisible layers, or metadata intended to manipulate LLM-based workflows. PDF Deinjection removes that hidden content by rendering each page into a plain image and rebuilding a clean PDF from those rasterized pages.
- Install Python 3.10 or newer.
- Install uv:
pip install uv - Clone the repository.
- Sync the project environment:
uv sync- Launch the app in GUI mode:
uv run python main.py --guiuv run python main.py --gui- Drag PDF files or folders into the left queue panel, or use
Add Files/Add Folder. - Select a file to preview its first page.
- Adjust DPI, output format, JPEG quality, output folder, and conflict mode from the right panel.
- Click
STARTto begin rasterizing queued files. - Click
CANCELto stop a running batch. Partial output for the in-progress file is removed automatically.
uv run python main.py input.pdf --dpi 150 --format JPEG --quality 85 --conflict auto-renameExamples:
uv run python main.py report.pdf
uv run python main.py papers --include-subfolders --format PNG
uv run python main.py a.pdf b.pdf --output-dir converted --conflict overwriteCLI options:
--gui: force desktop mode--dpi: render resolution from 72 to 300--format:JPEGorPNG--quality: JPEG quality from 1 to 100--output-dir: custom output folder--conflict:overwrite,skip, orauto-rename--include-subfolders: recursively scan folder inputs for PDFs
build.batGenerated files:
dist/PDF Deinjection.exe: GUI applicationdist/pdf-deinjection-cli.exe: CLI application
- Windows desktop GUI built with CustomTkinter
- CLI mode for scripted or batch workflows
- PDF rasterization powered by PyMuPDF
- JPEG or PNG intermediate encoding
- Automatic output naming with
_deinjectedsuffix - Conflict handling: overwrite, skip, or auto-rename
- Queue preview with first-page thumbnail
- Persistent config saved in
config.json - Cancel support with partial-file cleanup
- uv-managed environment and PyInstaller packaging
MIT
