Turn any PDF into clean Markdown with a self-hosted Docling API
I kept hitting the same wall building LLM pipelines: PDFs are where clean data goes to die. Tesseract chokes the moment a document has a table, multi-column layout, or a scanned page with any skew. You end up hand-rolling regex to patch up garbage OCR output, which is a miserable way to spend an afternoon.
Docling (IBM's open-source document parser) actually solves this. It converts PDFs, DOCX, PPTX, images, and scanned docs into clean Markdown or JSON — tables come out as real tables, reading order survives multi-column layouts, and it does all of this with local layout models, so nothing leaves your machine.
Why this matters for LLM pipelines specifically
Feeding an LLM "PDF text dumped via pdftotext" gives it garbage: table cells smeared into running prose, headers and footers interleaved with body text, reading order scrambled on multi-column pages. Docling's layout model actually understands document structure before it extracts text, so what comes out the other end is something an LLM (or a human) can actually use for RAG, summarization, or extraction.
Running it
Docling ships a FastAPI-compatible serving mode, so you can stand up a REST API instead of calling the Python library directly:
POST /v1/convert/file
with a PDF/DOCX/image attached, gets you Markdown or JSON back.
Deploying it
I maintain a one-click Railway template for this — deploy Docling on Railway. Full disclosure: I get a kickback if you deploy through it. It's the stock Docling serve image, nothing patched, and it's just as easy to run yourself if you'd rather not go through the referral link:
docker run -p 5001:5001 ghcr.io/docling-project/docling-serve:latest
One thing worth knowing before you deploy: it wants around 2GB of RAM for the layout models to load comfortably — undersize the container and you'll see OOM kills on larger documents rather than a clean error.
Quick example
curl -X POST http://your-instance/v1/convert/file \
-F "files=@invoice.pdf" \
-F "to_formats=md"
That's it — no API key setup, no cloud OCR bill, no rate limits. If you're building anything that ingests PDFs for an LLM, it's worth the 2 minutes to try.
Top comments (0)