# Docling: Turn Messy Documents into Clean Data for Your AI App

> Source: <https://dev.to/arshtechpro/docling-turn-messy-documents-into-clean-data-for-your-ai-app-3gnp>
> Published: 2026-09-19 20:57:15+00:00

If you've built anything with LLMs, you've hit this wall: your data lives in PDFs, Word files, slide decks, and scanned images. You need clean text to feed a model or a RAG pipeline. Basic PDF-to-text tools give you a jumbled mess: tables collapse into random lines, two-column layouts get read in the wrong order, and headers mix with body text.

Docling is an open-source Python library built to solve exactly that.

Docling reads documents and converts them into structured output such as Markdown, HTML, or JSON. It was started by IBM Research Zurich, is now hosted by the LF AI & Data Foundation, and is MIT licensed. It has over 66k stars on GitHub, so it's far from a side project.

What sets it apart from a plain text extractor is that it tries to *understand* the page. It detects layout and reading order, rebuilds tables, and recognizes code blocks, formulas, and images.

Input formats include PDF, DOCX, PPTX, XLSX, HTML, EPUB, images, LaTeX, email files, and even audio and video (transcribed with speech recognition models). Scanned PDFs are handled with OCR.

Everything is converted into one internal format called `DoclingDocument`, which you can then export as Markdown, HTML, or lossless JSON. That means your downstream code deals with one structure no matter what the input was.

You need Python 3.10 or newer.

```
pip install docling
```

Convert a document from the command line:

```
docling https://arxiv.org/pdf/2206.01062
```

This writes a `.md` file to your current directory.

Or use it from Python:

``` python
from docling.document_converter import DocumentConverter

converter = DocumentConverter()
result = converter.convert("https://arxiv.org/pdf/2408.09869")
print(result.document.export_to_markdown())
```

That's it. Local file paths work the same way as URLs.

Docling has ready-made integrations with LangChain, LlamaIndex, CrewAI, and Haystack, so you can drop it into an existing RAG pipeline as the document loader. It also ships an MCP server for connecting it to AI agents, and an API server (`docling-serve`) if you'd rather run it as a service than import it as a library.

It runs fully locally, which matters if you're handling sensitive documents or working in an air-gapped environment. No data has to leave your machine.

Yes, if any of these describe you:

A few honest caveats. Docling uses machine learning models for layout and table detection, so the install is heavier than a lightweight library like `pypdf`, and models are downloaded on first run. Processing large PDF batches on CPU can be slow, and a GPU helps a lot. If all you need is raw text from simple, single-column PDFs, a lighter tool will do the job with less overhead.
