Skip to content

OCR for scanned documents and handwriting

Scans are where classic OCR struggles: skew, stains, faded type, handwriting in the margins. ReadAnyDoc reads scanned pages with a vision model, checks the result against local OCR, re-reads doubtful strips zoomed in, and sends handwritten pages to a stronger model. Characters it cannot read are marked [illegible] instead of guessed.

pip install "readanydoc[engine]"
export ANTHROPIC_API_KEY=...
import readanydoc

result = readanydoc.parse("scan.pdf")
print(result.markdown)
for w in result.warnings:
    print("check:", w)

Tips

  • See a faded 1904 invoice read end to end in Real documents.
  • Handwritten pages go to Claude Sonnet 5.5 by default; handwriting_model=None keeps them on the main model.
  • Install Tesseract (brew install tesseract or apt install tesseract-ocr) for the best results on scans.

Next