New release: November 2026

LangChain document loader for OCR: scanned PDFs as Documents

The OcrSoftwareLoader takes one file or a list of PDF, PNG, JPEG or TIFF files and returns one LangChain Document per file, as text or Markdown. Scans reach your chain like any other loaded source, and you see which ones came in incomplete.

Install the LangChain OCR loader from GitHub

The loader is MIT-licensed and the source is public; it needs Python 3.10 or newer. Neither the loader nor the ocr-software client under it is on PyPI yet, so install both from GitHub:

pip install git+https://github.com/ocr-software/ocr-software-python \
    git+https://github.com/ocr-software/langchain-ocr-software
export OCR_SOFTWARE_API_KEY=ocr_...

When the loader runs against the hosted API, the key comes from the order page; it reads the key from OCR_SOFTWARE_API_KEY.

LangChain OCR example: load a scanned PDF

from langchain_ocr_software import OcrSoftwareLoader

loader = OcrSoftwareLoader("scan.pdf", pipeline="scan-ctc@2")
docs = loader.load()   # or loader.lazy_load()
print(docs[0].page_content, docs[0].metadata)

Name the pipeline yourself (ocr-software --list-pipelines lists them) and set format="md" for Markdown where the pipeline offers it. The key comes from OCR_SOFTWARE_API_KEY unless you pass api_key.

LangChain OCR with incomplete pages: how failures show up

If a page fails, loading continues and the Document carries metadata["incomplete"] with the reason, so your chain can route it to a person. Missing, empty or unsupported files are skipped with a log warning. Only a wrong key or address stops loading. Files go one after another, with a single job open at the API.

Run the LangChain loader against your own server

Point base_url at your own server, for example http://127.0.0.1:8080; nothing else changes (install guide).

Production use, high volume or your own server?

Private use and tests are free. For a company in production, a server of your own or a pipeline built on your pages, send the kind of page and the volume, and get a written offer.

Ask for an offer