Haystack OCR converter: scanned PDFs as Documents in your pipeline
The OcrSoftwareConverter takes PDF, PNG, JPEG or TIFF files and returns one Haystack Document per file, as text or Markdown. Scans enter your RAG pipeline like any other source, and you see which ones came in incomplete.
Install the Haystack OCR converter from GitHub
The component is MIT-licensed and the source is public; it needs Python 3.10 or newer and haystack-ai 2 or 3. Neither the converter nor the ocr-software client it builds on 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/ocr-software-haystack
export OCR_SOFTWARE_API_KEY=ocr_...
When the converter runs against the hosted API, the key comes from the order page; it reads the key from OCR_SOFTWARE_API_KEY.
Haystack OCR example: read a scanned PDF
from ocr_software_haystack import OcrSoftwareConverter
converter = OcrSoftwareConverter(pipeline="scan-ctc@2")
documents = converter.run(sources=["scan.pdf"])["documents"]
print(documents[0].content, documents[0].meta)
The pipeline argument is required. ocr-software --list-pipelines shows the names, and format="md" returns Markdown where the pipeline offers it.
Haystack OCR with incomplete pages: how failures show up
When a page fails, the run goes on and the Document carries meta["incomplete"] with the reason, so your pipeline can route it to a person. Unreadable or unsupported files are skipped with a log warning. Only a wrong key or address ends the run. The converter reads file after file, so it keeps one job open at the API.
Save the pipeline to YAML without the key
to_dict and from_dict keep the key out of the file; it is read from the environment. Haystack 3 loads only approved modules from YAML: Pipeline.loads(text, allowed_modules=["ocr_software_haystack"]).
Run the Haystack converter against your own server
Set base_url to your own server, for example http://127.0.0.1:8080; the code stays as it is (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.