pdf-patch

Installation
SKILL.md

Scanned PDF Text Repair

Use this skill for image-only PDFs where text extraction returns empty or does not contain the target text. The goal is visual repair: rebuild the page image with a small localized patch, not semantic PDF text editing.

Workflow

  1. Inspect the PDF before editing.

    • Count pages with PyMuPDF.
    • Extract text with page.get_text().
    • If the target text is absent and the page has one or more images, treat it as scanned/image-only.
    • Render the page at 2x or 3x scale and inspect the target area.
    • Prefer scripts/inspect_pdf.py for this step.
  2. Locate the exact patch.

    • Use rendered pixel coordinates, not guessed PDF point coordinates.
    • Crop the target line and identify dark-pixel runs for each character.
    • Patch only the old character/phrase plus a tiny margin.
    • Do not repaint surrounding text unless the user explicitly wants phrase-level replacement.
    • Use scripts/find_dark_runs.py on the rendered page or crop when exact character bounds are unclear.
Installs
1
Repository
hopesy/skills
GitHub Stars
1
First Seen
Aug 6, 2026
pdf-patch — hopesy/skills