Choosing between Docling and LlamaParse comes down to how you want to extract tables from a PDF in Python: on your own machine or in the cloud. Docling runs locally as an open-source library, while LlamaParse parses through an LLM-guided cloud pipeline. This tutorial builds the same table extractor twice to compare quality, setup, output formats, speed, and cost using a single sample PDF.
By the end of this tutorial, you’ll understand that:
- IBM’s Docling parses entirely on your own machine, needs no API key, and adds no per-document cost.
- LlamaIndex’s LlamaParse uploads every PDF to the cloud and parses it through tiers from
fasttoagentic_plus. - Docling exports straight to Markdown, JSON, HTML, and pandas DataFrames, while LlamaParse splits the work across a Parse path and an Extract path.
- Docling applies a fixed layout-detection stack, whereas LlamaParse interprets each page with an LLM.
- On a ten-page financial PDF, LlamaParse finished in about 30 seconds versus roughly 82 seconds for Docling on CPU.
Both parsers in this tutorial target the same sample_report.pdf, a table-heavy ten-page excerpt from an SEC 10-K filing, so you can compare their output directly.
You should be comfortable installing Python packages and running scripts from the terminal. Familiarity with files in Python helps, plus pandas DataFrames if you want DataFrame output.
You’ll also need the following before diving into this tutorial:
-
Python 3.10 or newer: Docling requires at least Python 3.10. Although LlamaParse also runs on 3.9, using the same minimum keeps both tools in a single environment. If you’re not sure which version you have, then run
python --versionin your terminal. If you need to install or upgrade, follow the steps in the guide on installing Python. -
LlamaCloud account (LlamaParse only): You’ll need this account to generate an API key. Never paste your API key directly into source code. Store it as the
LLAMA_CLOUD_API_KEYenvironment variable instead. The setup section below shows how to install the SDK and export the key for your operating system. -
Sample PDF: Keep
sample_report.pdfin your working directory. You can find it in the tutorial downloads if you want to follow along. -
Virtual environment: Create and activate one before installing any packages. If virtual environments are new to you, then Python Virtual Environments: A Primer will get you up to speed.
The exact commands depend on your operating system:
Don’t worry if you’ve never parsed a PDF programmatically. This tutorial walks you through installation from scratch, a first parse, and a side-by-side output comparison.
Get Your Code: Click here to download the free sample code that you’ll use to extract tables from a PDF with Docling and LlamaParse.
Take the Quiz: Test your knowledge with our interactive “Docling vs LlamaParse: How to Extract PDF Tables in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:
Interactive Quiz
Docling vs LlamaParse: How to Extract PDF Tables in PythonTest your understanding of extracting PDF tables in Python with Docling and LlamaParse, and of when to parse locally instead of in the cloud.
Metrics Comparison: Docling vs LlamaParse
Use this table as an at-a-glance summary of packages, infrastructure requirements, and ballpark performance before the walkthroughs below:
| Metric | Docling | LlamaParse |
|---|---|---|
| Python package | docling |
llama-cloud (>=2.9.0) |
| Minimum Python version | 3.10 | 3.9 |
| Additional downloads on first run | Yes, layout and table models (~500–600 MB) | No, parsing runs in the cloud |
| Time to first parse (fresh install) | Slower, model download first | Faster, pip and API key only |
| API key required | No | Yes, LLAMA_CLOUD_API_KEY |
| Documents leave your machine | No | Yes, PDFs are uploaded for server-side parsing |
| Internet required at parse time | No, once models are cached | Yes |
| Marginal cost per document | $0 (local compute only) | Free tier of 10,000 credits per month, then paid tiers |
| Parse tiers | Not applicable (single local pipeline) | fast, cost_effective, agentic, agentic_plus (tutorial uses agentic) |
| Typical parse time (ten-page PDF, see Benchmarks) | ~10–20 s (text-heavy), ~60–90 s (table-heavy) on CPU | ~30 s over the network on the sample PDF (not tied to local CPU) |
| GPU support | Optional, speeds up layout analysis | Not applicable (server-side) |
| Primary maintainer | IBM Research (open source, MIT) | LlamaIndex (managed SaaS) |
| Best-known strength | Structured local pipelines, DataFrame export | Zero-infra setup, charts and unusual layouts |
Note: The llama-parse and llama-cloud-services packages were deprecated in May 2026. See also LlamaIndex’s announcement of the new llama-cloud SDKs and Parse API v2. All LlamaParse examples in this tutorial use llama-cloud>=2.9.0, which targets Parse API v2.
The next section turns this comparison into a practical recommendation.
Setup and Operational Model
For day-to-day work, the practical details matter most: how you install each tool, whether you need an API key, and where the parsing runs. Every example below uses the same sample_report.pdf from the tutorial downloads, so you can compare output directly.
Docling: Open-Source Parsing on Your Own Machine
Docling installs like any other Python library, but its default OCR engine, RapidOCR, prefers the onnxruntime backend, which a plain pip install docling doesn’t include:
(.venv) $ python -m pip install "docling==2.102.2"
(.venv) $ python -m pip install "onnxruntime>=1.7.0,<2.0.0"
These two packages give Docling its core converter and the OCR backend that this tutorial expects.
Note: Without onnxruntime, parsing still completes on Docling 2.102.2. Auto OCR skips the onnxruntime RapidOCR path, skips EasyOCR if it isn’t installed, then selects RapidOCR with the torch backend that already ships with Docling. At the info level, you see lines like:
rapidocr cannot be used because onnxruntime is not installed.
easyocr cannot be used because it is not installed.
Auto OCR model selected rapidocr with torch.
That torch fallthrough isn’t the path this tutorial targets, so install onnxruntime as shown above.