Convert scanned PDF documents to structured Markdown with OCR and signature detection.
- OCR Text Extraction: Converts scanned PDFs to text using Tesseract
- Structured Markdown: Detects headings, paragraphs, and lists
- Image Extraction: Extracts and deduplicates embedded images
- Signature Detection: Identifies signature regions and matches against expected signers
- Metadata Generation: Creates
metadata.jsonwith conversion stats - Windows Support: Handles paths with spaces and special characters
- Python 3.11+
- Tesseract OCR (see INSTALL.md for installation guide)
cd PDFtoMD
pip install -e .pdfmd convert document.pdfpdfmd convert document.pdf -o ./output/document.mdpdfmd convert document.pdf --signers "Juan Pérez,María García"pdfmd convert document.pdf --pages "0,1,2,3,4"pdfmd info document.pdfpdfmd --version| File | Description |
|---|---|
document.md |
Structured Markdown with OCR text |
metadata.json |
Conversion stats (pages, confidence, time) |
signature_report.md |
Signature detection report |
signature_report.json |
Signature data in JSON format |
images/ |
Extracted images (if any) |
Usage: pdfmd [OPTIONS] INPUT_PATH
Options:
-o, --output PATH Output Markdown file path
-l, --lang TEXT OCR language (default: spa)
-d, --dpi INTEGER Render DPI (default: 300)
-s, --signers TEXT Comma-separated list of expected signers
-p, --pages TEXT Pages to process (e.g., '0,1,2' or '0-5')
-v, --version Show version
--help Show this message and exit
pytest tests/ -vruff check pdfmd/MIT