cd /news/developer-tools/turn-any-pdf-into-clean-markdown-wit… · home topics developer-tools article
[ARTICLE · art-74757] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Turn any PDF into clean Markdown with a self-hosted Docling API

A developer highlights Docling, an open-source document parser from IBM, that converts PDFs, DOCX, PPTX, images, and scanned documents into clean Markdown or JSON while preserving tables, reading order, and multi-column layouts. The tool runs locally with layout models, ensuring data privacy, and can be deployed as a self-hosted REST API via Docker or a Railway template. The developer notes that the container requires about 2GB of RAM to avoid out-of-memory errors.

read2 min views1 publishedJul 27, 2026

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.

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.

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.

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.

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.

── more in #developer-tools 4 stories · sorted by recency
── more on @docling 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/turn-any-pdf-into-cl…] indexed:0 read:2min 2026-07-27 ·