To use Docling pdf to markdown extraction, install it with pip install docling on Python 3.10 or higher, then run docling your-file.pdf in a terminal or call DocumentConverter().convert() in Python. Docling is free under the MIT licence and runs locally, so your documents never leave your machine. In our worked example, replacing a paid parsing tier for 5,000 pages a month saves $720 a year in licence and credit fees.
Your AI chatbot is only as smart as the text you feed it. If your PDFs arrive as scrambled columns, broken tables, and missing headings, no model can rescue the answer. That is the quiet problem Docling pdf to markdown conversion solves: it reads the page layout first, then hands your AI clean, structured text.
Quick Answer
To use Docling pdf to markdown extraction, install it with pip install docling on Python 3.10 or higher, then run docling your-file.pdf in a terminal or call DocumentConverter().convert() in Python. Docling is free under the MIT licence and runs locally, so your documents never leave your machine. In our worked example below, replacing a paid parsing tier for 5,000 pages a month saves $720 a year in licence and credit fees.
In this article
- How we checked this guide
- What Docling replaces, and what it does not
- How Docling pdf to markdown conversion works
- CLI, Python library, API server, or paid parser
- Requirements before you install Docling
- Step 1: install Docling
- Step 2: convert your first PDF to Markdown
- Step 3: turn on OCR for scanned pages
- Step 4: chunk the output for RAG
- Step 5: check tables, headings, and reading order
- First-run security steps you must not skip
- Backup and update routine
- Common errors and fixes
- Tips and tricks that save money
- The real cost maths
- When not to self-host Docling
- Pros and cons
- Our verdict
- FAQ
- Strategic Pivot
- Sources
How we checked this guide
We verified every install command, requirement, and licence fact on the official Docling GitHub repository, the official Docling documentation, and the Docling PyPI page on December 2, 2026. Paid comparison prices come from the official LlamaIndex pricing page, checked the same day. Nothing here is copied from a roundup.
Where the official docs name a limit — an unsupported Python version, a missing OCR engine, a platform caveat — we say so plainly. If a claim could not be verified on an official page, it stays out of this guide.
What Docling replaces, and what it does not
Docling replaces the paid document-parsing step in an AI workflow. Many small businesses pay a parsing API per page just to turn invoices, contracts, manuals, and reports into text a chatbot can search. Docling does that conversion on your own computer or server, for a $0 licence fee.

It also replaces the fragile do-it-yourself stack of separate PDF text extractors, table scrapers, and OCR scripts. One converter handles PDF, DOCX, PPTX, XLSX, HTML, EPUB, images, email files, and more, and exports Markdown, HTML, or lossless JSON from a single document model.
What Docling does not replace is the rest of your AI stack. It does not embed text, store vectors, or answer questions. You still need an embedding model, a vector store, and a framework such as the one in our LlamaIndex RAG app guide or our Haystack RAG chatbot guide.
Think of Docling as the prep cook, not the chef. It washes, chops, and labels the ingredients. Your RAG framework still has to cook the meal.
Best for: owners and operators who process business documents every week and want the parsing bill to stop growing with page count. Skip if: you convert three PDFs a year and have no one who can run a Python command — a hosted parser will feel easier.
How Docling pdf to markdown conversion works
A plain PDF text extractor reads characters in file order, which is often not reading order. Two-column layouts interleave, tables collapse into word salad, and headings lose their rank. Docling instead runs layout and table-structure models over the page, so it knows what is a heading, what is a paragraph, and which cells belong to which table row.
The result is a unified DoclingDocument: one structured representation of the file. From that single object you can export Markdown for a chatbot, HTML for a web page, or lossless JSON when you need page numbers, bounding boxes, and element types for auditing.
For scanned PDFs and images, Docling adds OCR. The default install includes RapidOCR, and the docs support EasyOCR, Tesseract, OcrMac, and other engines as options. That matters for a business whose archive is paper-first: supplier invoices, signed forms, and old price lists become searchable text instead of dead scans.
Docling runs locally, including in air-gapped environments, according to the official feature list. For a firm handling client contracts or patient-adjacent paperwork, that local execution is not a nice extra. It is the reason to choose self-hosting at all.
The project is hosted by the LF AI & Data Foundation and was started by the AI for knowledge team at IBM Research Zurich. The codebase is MIT licensed, while individual models carry their own licences in their original packages — a detail worth checking before commercial redistribution.
CLI, Python library, API server, or paid parser
You have four honest ways to get Markdown out of a PDF. The right one depends on volume, privacy, and who maintains the machine.
| Route | Licence / price anchor | Best for | Skip if |
|---|---|---|---|
| Docling CLI | $0, MIT | One-off conversions and batch jobs on your own machine | You need an always-on service for a team |
| Docling Python library | $0, MIT | Pipelines that convert, chunk, and embed in one script | Nobody on the team writes Python |
| Docling API server (docling-serve) | $0, MIT | Several apps or staff sharing one conversion service | You cannot patch and monitor a server |
| LlamaParse (paid) | $0/month with 10,000 free credits, then $1.50 per 1,000 credits | Zero-maintenance parsing with support | Page volume makes credits the biggest line item |
The CLI is the fastest way to prove value: one command, one Markdown file, no code. The Python library is where the money is saved at scale, because conversion, chunking, and embedding become one repeatable job. The API server (docling-serve) suits a small team that wants one shared endpoint instead of five laptop installs.
The paid parser still wins on one axis: nobody has to maintain anything. If your page volume is low, the free monthly credits may cover you entirely, and this guide’s cost maths will show you exactly where the crossover sits.
Requirements before you install Docling
Docling needs Python 3.10 or higher. The official README notes that Python 3.9 support was dropped in Docling version 2.70.0, so an old system Python will fail before you convert a single page. Check your version first and save yourself a confusing error.
The package works on macOS, Linux, and Windows, on both x86_64 and arm64 architectures. Under the hood, the Docling models depend on PyTorch, which is why the install is heavier than a typical utility package. On a Linux server without a GPU, the docs recommend the CPU-only PyTorch index so you do not download accelerator wheels you will never use.
Intel Mac owners need one extra step. Newer PyTorch versions (2.6.0 and later) no longer ship wheels for Intel-based Macs, so the docs point you to the docling[mac_intel] extra with a compatible PyTorch, and Python 3.12 or lower.
You also need disk space and patience for the first run. Models download on first use, and a CPU-only machine will convert pages more slowly than a GPU box. That is a throughput question, not a correctness one — the Markdown is the same.
Finally, decide where converted files will live. A simple folder discipline — originals untouched, Markdown output versioned by date — prevents the classic accident of overwriting the only copy of a source document.
Step 1: install Docling
Create a clean Python environment first, so Docling’s dependencies never collide with another project’s. A virtual environment or uv project both work; the official docs show both pip and uv routes.

Install the package with pip:
pip install doclingOr, with uv:
uv add doclingOn a Linux server with no GPU, use the CPU-only PyTorch index exactly as the installation docs suggest:
pip install docling --extra-index-url https://download.pytorch.org/whl/cpuThat single flag can save gigabytes of unused accelerator downloads and a long, pointless wait on a small VPS. On an Intel Mac, install the dedicated extra instead:
pip install "docling[mac_intel]"Optional extras unlock specific engines and pipelines. The docs list extras for EasyOCR (easyocr), the Tesseract binding (tesserocr), OcrMac (ocrmac), RapidOCR (rapidocr), the vision-language-model pipeline (vlm), and audio transcription (audio). Install only what your documents need; every extra is another dependency to update.
Verify the install before you trust it. Run docling --help and confirm the CLI answers. If the command is not found, your environment is not active — fix that first, because every later step assumes the CLI is on your path.
Pin the version you tested. The PyPI page listed Docling 2.156.0 on December 2, 2026, and the project releases frequently. A pinned version in your requirements file means a routine reinstall next quarter reproduces today’s behaviour instead of surprising you.
Step 2: convert your first PDF to Markdown
Start with a document you know well — a price list, a policy, a short report — so you can judge the output against reality. The CLI converts a local path or a URL and writes a Markdown file in the current directory:
docling your-file.pdfOpen the generated .md file and read it like a customer would. Headings should carry their # ranks, paragraphs should read in order, and tables should still look like tables. This five-minute read is your quality gate; never pipe uninspected output into a chatbot.
For repeatable jobs, use the Python API, which the project recommends:
from docling.document_converter import DocumentConverter
converter = DocumentConverter()
result = converter.convert("your-file.pdf")
print(result.document.export_to_markdown())The same result.document can export HTML or lossless JSON when Markdown is not enough. JSON is the format to keep when you need page provenance — which page a price came from, and where on the page it sat.
Batch conversion is where the savings compound. A folder of supplier PDFs becomes a folder of Markdown files in one run, ready for chunking. Keep the originals read-only and write output to a separate directory, so a bad run can be deleted and repeated without fear.
One honest limit: Docling understands structure, not truth. If the source PDF contains a wrong price, the Markdown will faithfully contain the wrong price. Conversion quality and content quality are separate checks, and your business owns the second one.
Step 3: turn on OCR for scanned pages
Born-digital PDFs carry a text layer, so conversion is fast and accurate. Scanned pages are pictures, and pictures need OCR before any Markdown exists. The default Docling install includes RapidOCR through its standard bundle, so basic OCR works without extra steps.
When you need a specific engine, the docs show the pattern clearly. This example selects Tesseract through pipeline options:
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions, TesseractOcrOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
pipeline_options = PdfPipelineOptions()
pipeline_options.do_ocr = True
pipeline_options.ocr_options = TesseractOcrOptions()
converter = DocumentConverter(
format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)}
)Tesseract is a system dependency, not a pip package. On Debian or Ubuntu the docs give the apt line (apt-get install tesseract-ocr tesseract-ocr-eng libtesseract-dev libleptonica-dev pkg-config), and you must export TESSDATA_PREFIX so Tesseract finds its language files. Run tesseract --list-langs to confirm the languages you need are actually installed.
Language choice is a cost driver in disguise. The Tesseract options default to English, Spanish, French, and German, and conversion fails if one of those language packs is missing. Set the language list to what your documents really use — docling --ocr-engine tesseract --ocr-lang eng on the CLI — and the failure disappears.
Test OCR on your worst scan, not your best. A faded fax or a phone photo of a receipt is the honest benchmark. If that page converts cleanly, the rest of the archive will follow.
Step 4: chunk the output for RAG
Markdown alone does not make a chatbot. Retrieval systems split documents into chunks, embed each chunk, and fetch the closest ones at question time. Chunk boundaries decide whether the fetched text contains the whole answer or half of it.

Docling ships native chunkers that operate on the DoclingDocument directly, so headings, captions, and table structure survive into the chunks. The HybridChunker is the practical default: it starts from hierarchical, document-aware chunks, then splits only oversized chunks and merges undersized neighbours using your embedding model’s tokenizer.
Table handling is where native chunking earns its keep. With repeat_table_header enabled (the default), a table that spans several chunks repeats its header row in each one, so a retrieved chunk still says which column is the price and which is the quantity. A naive text splitter loses that context silently.
The usage pattern is short:
from docling.chunking import HybridChunker
chunker = HybridChunker()
chunks = list(chunker.chunk(result.document))
for chunk in chunks:
print(chunker.contextualize(chunk))The contextualize call returns the metadata-enriched text you feed to the embedding model — headings and captions included. That enrichment is free retrieval quality: the chunk carries its own context instead of hoping the model guesses it.
From here, the chunks flow into the frameworks covered in our LlamaIndex RAG app guide and Haystack RAG chatbot guide. Docling’s integrations with LangChain, LlamaIndex, CrewAI, and Haystack exist precisely so this handoff is a few lines, not a rewrite.
Step 5: check tables, headings, and reading order
Before any converted file reaches customers, run three checks. First, reading order: pick a two-column page and confirm the Markdown reads down one column, then the other, instead of zig-zagging across both. Second, tables: confirm row counts match the source and no column has drifted into its neighbour. Third, headings: confirm the heading ranks match the document’s real structure, because your chunker and your chatbot both navigate by them.
Numbers deserve their own check. Prices, quantities, dates, and phone numbers are where a conversion error becomes a business error. Spot-check every figure type against the source PDF, especially in tables with merged cells or footnote markers.
Build a small golden set: five documents you have verified by hand, covering a clean PDF, a scanned page, a dense table, a multi-column layout, and an Office file. Re-run the golden set after every Docling upgrade. If the output changes, you learn it from your test, not from a customer complaint.
Keep the lossless JSON export for audited documents. When a chatbot answer is challenged, JSON provenance lets you point to the exact page and region the text came from. That traceability is hard to retrofit and trivial to keep from day one.
First-run security steps you must not skip
Local execution is Docling’s security headline: documents convert on your machine, which the project explicitly supports for sensitive data and air-gapped environments. That advantage only holds if you treat the conversion machine like part of your records system, because it now holds copies of everything you parse.
Keep source documents and converted output under the same access rules as the originals. A Markdown export of a client contract is still a client contract. Folder permissions, encrypted disks, and a short list of who can read the output directory are not bureaucracy; they are the control that makes local parsing safer than an upload.
If you run docling-serve as a shared API, put it behind authentication and inside your network boundary. An open conversion endpoint is an invitation for strangers to burn your CPU and, worse, to probe your document store. The service is a convenience for your team, not a public utility.
Be careful with URL conversion. Converting a remote PDF means your server fetches whatever that URL serves. Restrict URL inputs to sources you trust, and prefer local files for anything sensitive.
Finally, remember the model licence note from the repository: the Docling codebase is MIT, but individual models carry their own licences in their original packages. For internal business use this is rarely a blocker, yet it is a one-line check worth doing before you redistribute a bundled product.
Backup and update routine
Your backup unit is not the Markdown alone. Keep three things: the original documents, the converted output, and the exact environment that produced it (the pinned Docling version and your conversion script). With those three, any output can be regenerated; without the originals, nothing can.
Store originals read-only and back them up on the same schedule as your other business records. Converted output can be regenerated, so it needs a lighter touch — but regeneration costs CPU time, so keeping the output is still cheaper than rebuilding a large archive.
Updates deserve a routine, not enthusiasm. Docling releases often, and a new version can change layout or table output for the better — or shift a heading rank your chunker depended on. Upgrade in a test environment, re-run your golden set, compare the diffs, and only then promote the new version.
When you do upgrade, upgrade deliberately: bump the pinned version, note the date, and keep the previous version’s output until the new output passes checks. That paper trail turns a mysterious chatbot answer change into a five-minute investigation.
Common errors and fixes
Most Docling failures are environment problems wearing a disguise. Work through them in this order and you will fix the majority without touching your documents.
Python version too old. Python 3.9 support ended at Docling 2.70.0. If pip refuses the package or imports fail strangely, check python --version and move to Python 3.10 or higher.
ModuleNotFoundError: No module named 'cv2'. The table-structure model needs OpenCV. The standard install brings it in through RapidOCR, but a slim install without RapidOCR must add opencv-python-headless explicitly — and only one OpenCV package, never both.
“No OCR engine found” in the log. The automatic OCR selection never picks Tesseract. If you installed a slim build and selected no engine, conversion proceeds without OCR and scanned pages come out empty. Select your engine explicitly, in code or with --ocr-engine on the CLI.
Tesseract language failure. The Tesseract options default to English, Spanish, French, and German, and conversion fails when a listed language pack is absent. Install the packs you need, set TESSDATA_PREFIX, verify with tesseract --list-langs, and pass only the languages you actually use.
Intel Mac install failure. PyTorch 2.6.0 and later dropped Intel Mac wheels. Use the docling[mac_intel] extra with Python 3.12 or lower, exactly as the installation docs describe.
Empty output from a scanned PDF. The file is an image with no text layer and OCR is off or unselected. Enable OCR, choose an engine, and re-run — then check the worst page, not the first page.
Tips and tricks that save money
Convert once, reuse everywhere. The expensive mistake is re-parsing the same documents for every experiment. Keep the Markdown and JSON output, version it, and let every RAG test start from the saved conversion.
Use the CPU-only PyTorch index on servers without GPUs. It cuts download size and install time, and on a small VPS that is real money and real patience saved.
Match chunking to your embedding model. The HybridChunker accepts the tokenizer your embedding model uses, so chunks respect the real token limits instead of a guess. Oversized chunks get truncated by embedding APIs silently; tokenizer-aware chunking prevents that quiet data loss.
Keep table headers repeating. The repeat_table_header default exists because a price row without its header is a number without a meaning. Leave it on unless your tables are so wide that headers crowd out rows — the docs offer omit_header_on_overflow for exactly that case.
Batch during quiet hours. Conversion is CPU-hungry; a nightly batch on an existing machine costs almost nothing, while a dedicated always-on GPU server for occasional PDFs is a subscription you gave yourself.
Use the paid parser surgically, not habitually. If one pathological document defeats local conversion, a hosted tier can handle that single file while Docling carries the other ninety-nine percent. Hybrid beats dogma.
The real cost maths
Docling’s licence fee is $0 under the MIT licence. The honest comparison is therefore credits versus compute: what a paid parser charges per page, against the machine time and maintenance you already own.
The official LlamaIndex pricing page lists LlamaParse Pay-as-you-go at $0 per month with 10,000 free credits every month, then $1.50 per 1,000 credits. Pro is $500 per month with 400,000 credits, then $1.25 per 1,000. Parse tiers cost 1 credit per page (Fast), 3 (Cost-effective), 10 (Agentic), or 25 (Agentic Plus), and layout extraction adds 3 credits per page.

Now the scenario. A small trading firm converts 5,000 pages a month — supplier catalogues, invoices, and policy PDFs — and wants the stronger Agentic tier quality for messy tables. That is 5,000 pages × 10 credits = 50,000 credits. The free 10,000 credits cover the first slice, leaving 40,000 billable credits. At $1.50 per 1,000 credits, the bill is $60 a month, or $720 a year.
Run the same 5,000 pages through Docling on a machine the firm already owns. The licence is $0, the per-page fee is $0, and the marginal cost is electricity and a nightly batch window. Even if you price in a modest share of a small server, the parsing line item collapses from $720 a year to the cost of hardware you were already paying for.
The crossover cuts both ways, and honesty matters. At 500 pages a month on the Fast tier, LlamaParse uses 500 credits — fully inside the free 10,000 — and costs $0 with zero maintenance. Docling wins when volume, tier quality, or privacy pushes you past the free credits; below that line, the paid parser’s free tier is genuinely free.
| Monthly volume | LlamaParse Agentic cost | Docling licence cost |
|---|---|---|
| 500 pages | $0 (5,000 credits, inside free tier) | $0 |
| 5,000 pages | $60/month = $720/year | $0 |
| 20,000 pages | $285/month = $3,420/year | $0 |
The 20,000-page row: 200,000 credits minus 10,000 free = 190,000 billable credits × $1.50 per 1,000 = $285 a month. The pattern is the point — paid parsing scales linearly with pages, while Docling’s cost stays flat until your hardware does.
What the table leaves out is your time. Budget a few hours for installation, golden-set checks, and quarterly updates. At any reasonable hourly rate, that time is repaid quickly once monthly volume passes a few thousand pages — and never repaid if you convert a handful of files a year.
When not to self-host Docling
Skip self-hosting when nobody can maintain it. A conversion service that breaks silently after an untested upgrade is worse than a paid API that simply works. If your team has no Python comfort at all, the free credits of a hosted parser are the rational choice.
Skip it when volume is tiny. Under the free-credit line, self-hosting saves $0 and costs attention. Spend that attention on the chatbot’s answers instead.
Skip it when you need contractual guarantees — uptime commitments, compliance attestations, or a support desk. The LlamaParse Enterprise tier sells exactly those assurances, including single-tenant and on-premises deployment. Docling gives you control; it does not give you a vendor to call at 2 a.m.
And skip it when your documents are mostly clean, born-digital text that a simpler extractor already handles. Docling earns its place on layout, tables, and scans. If your PDFs are plain paragraphs, the heavy machinery is ceremony.
Pros and cons
Pros
- Free under the MIT licence, with no per-page fees at any volume.
- Runs locally, including air-gapped setups, so sensitive documents never leave your machine.
- Advanced PDF understanding: layout, reading order, table structure, code, and formulas.
- One converter for PDF, Office files, HTML, EPUB, images, email, and more.
- Native chunkers with table-header repetition, built for RAG pipelines.
- Integrations with LangChain, LlamaIndex, CrewAI, and Haystack, plus an MCP server and API server.
Cons
- You maintain the Python environment, model downloads, and updates yourself.
- CPU-only conversion is slower than a hosted API on large batches.
- OCR quality depends on engine and language-pack setup, which you must configure.
- Individual models carry their own licences, separate from the MIT codebase.
- No vendor support desk, uptime guarantee, or compliance paperwork.
Our verdict
Install Docling when documents are a recurring cost or a privacy concern. For a business converting thousands of pages a month, the maths is not close: $0 in licence fees against a per-page bill that grows forever. The setup is an afternoon, the golden-set checks are an hour a quarter, and the output feeds every RAG framework you might choose later.
Choose the paid parser when volume is low or maintenance capacity is zero. Below the free-credit line, hosted parsing is free and effortless, and pretending otherwise would be dishonest advice.
The deciding question is simple: will you still be converting documents next year? If yes, own the conversion layer. If no, rent it.
FAQ
Is Docling free for commercial use?
Yes. The Docling codebase is released under the MIT licence, so the licence fee is $0 for commercial use. Individual models carry their own licences in their original packages, so check those if you redistribute a bundled product.
Does Docling work offline?
Yes. Docling runs locally and the project explicitly supports sensitive-data and air-gapped environments. After the first model download, conversion needs no internet connection and no API key.
Can Docling handle scanned PDFs?
Yes, with OCR. The standard install includes RapidOCR, and the docs support EasyOCR, Tesseract, OcrMac, and other engines. Select the engine and languages explicitly, and test on your worst scan before trusting the archive-wide output.
How does Docling compare with LlamaParse on cost?
Docling charges $0 per page. LlamaParse Pay-as-you-go includes 10,000 free credits monthly, then charges $1.50 per 1,000 credits; at the Agentic tier’s 10 credits per page, 5,000 pages a month costs $60. Below the free credits, LlamaParse also costs $0.
What should I use Docling output with?
Feed the Markdown or chunks into a RAG framework. Docling integrates with LlamaIndex, Haystack, LangChain, and CrewAI, and its HybridChunker produces tokenizer-aware chunks with table headers repeated, ready for embedding.
Strategic Pivot
Before you commit to a parsing route, price the whole document pipeline, not only the licence. Use our AI Cost Calculator to compare self-hosted conversion against per-page parsing fees once you have your monthly page count, tier choice, and hosting cost.
Sources
- Docling GitHub repository: https://github.com/docling-project/docling
- Docling documentation: https://docling-project.github.io/docling/
- Docling installation guide: https://docling-project.github.io/docling/getting_started/installation/
- Docling chunking concepts: https://docling-project.github.io/docling/concepts/chunking/
- Docling on PyPI: https://pypi.org/project/docling/
- LlamaIndex pricing (LlamaParse): https://www.llamaindex.ai/pricing
Price note — updated December 2, 2026: Prices in this post were checked on December 2, 2026. When you are reading this, the price may be lower or higher — always check the official pricing page before you buy.
Pros
- Free MIT licence with no per-page fees
- runs locally including air-gapped setups
- advanced PDF layout, reading order, and table structure
- one converter for PDF, Office, HTML, EPUB, images, and email
- native RAG chunkers with table-header repetition
- integrations with LlamaIndex, Haystack, LangChain, and CrewAI
Cons
- You maintain the Python environment and updates yourself
- CPU-only conversion is slower than a hosted API
- OCR quality depends on engine and language setup
- individual models carry separate licences
- no vendor support desk or uptime guarantee
Install Docling when documents are a recurring cost or a privacy concern. For thousands of pages a month the maths is not close: $0 in licence fees against a per-page bill that grows forever. Choose the paid parser when volume is low or maintenance capacity is zero.
