SuperAPI AI Directory

doc-ocr

Design & creation

View repository

Updated 10-15 20:33

About this skill

Doc-OCR Document Text Recognition

PDF / scanned file / image → editable text. PDFs with a text layer are extracted directly; scanned files are automatically OCR'd (built into macOS Vision, Chinese and English).

Trigger conditions

The user provides a PDF/image file and requests:

  • "Extract text", "convert to text", "OCR"
  • Process scanned files, contracts, invoices, book pages, screenshots

Usage steps

1. Single file

python3 scripts/dococr.py 合同.pdf
python3 scripts/dococr.py 发票.jpg

Save the output as <输入名>_ocr.txt。

2. Batch directory

python3 scripts/dococr.py ./扫描件/ -o 全部.txt

3. Markdown output

python3 scripts/dococr.py 书.pdf --md

Dependencies (installed on first use)

pip3 install pymupdf pyobjc-framework-Vision

Note: OCR depends on macOS Vision (only available on macOS). Linux requires installing another engine such as tesseract.

Known pitfalls

  • Scanned-file detection: A PDF text layer of <20 characters automatically goes through OCR; normal PDFs are extracted directly.
  • Handwriting: Vision works well on printed text/clear handwriting; messy handwriting is not guaranteed.
  • Privacy selling point: Files are processed locally and are not uploaded to third parties.