file2markdown
doclingpdfplumberpdfmarkdownragllmpythondocument parsing

Docling vs pdfplumber: Which One Belongs in Your PDF-to-Markdown Pipeline?

August 21, 2026

Docling vs pdfplumber: Which One Belongs in Your PDF-to-Markdown Pipeline?

If you search for Python PDF libraries, Docling and pdfplumber show up in very different conversations. Docling gets recommended for RAG pipelines that need clean Markdown out of complex, layout-heavy documents. pdfplumber gets recommended for precise, low-level text and table extraction. They solve overlapping problems in almost opposite ways — one uses AI layout models, the other uses raw character geometry — and picking the wrong one wastes real engineering time.

This guide compares them directly for the job most people actually have: turning a PDF into usable Markdown. If you'd rather skip the Python setup entirely, file2markdown converts the same files to clean Markdown through a browser or REST API.

The Quick Answer

Use Docling when you want structure-aware Markdown out of the box — headings, reading order, and tables detected automatically by layout models, with built-in OCR for scans.

Use pdfplumber when you need character-level precision — exact bounding boxes, font metadata, or table geometry you control yourself — and you're willing to write your own Markdown formatting logic.

Use file2markdown when you want hosted PDF-to-Markdown conversion with OCR included, without installing models or maintaining a parsing pipeline.

What Each Tool Actually Does

Docling started at IBM Research Zurich and is now maintained under the LF AI & Data Foundation. It's a document-understanding library: it runs AI layout models over a PDF to detect reading order, headings, and table structure, then exports a clean DoclingDocument you can render to Markdown, HTML, or JSON. Because it's doing layout analysis rather than just text extraction, it also includes OCR for scanned pages and image classification. The cost is a heavier install — it needs Python 3.10+ and pulls in the layout and table-structure models it runs locally.

pdfplumber wraps pdfminer.six with a friendlier API and gives you access to every character's exact position, font, and size on the page. That granularity is what makes its table extraction so reliable — it reconstructs rows and columns from character coordinates instead of guessing. But pdfplumber has no concept of "Markdown" or even "heading" — it hands you raw text and nested lists of table cells, and you decide what to do with them.

Head-to-Head Comparison

Doclingpdfplumber
Core modelAI layout understandingCharacter-level geometry
Markdown outputBuilt in (export_to_markdown())None — you build it yourself
Heading detectionAutomaticManual (font-size heuristics)
Table extractionAI table-structure modelCoordinate-based reconstruction
OCR for scanned PDFsBuilt inNone — needs an external engine
LicenseMITMIT
Install footprintLarge (layout/table models)Small (pure Python)
Best fitStructure-aware Markdown, RAG ingestionPrecise text/table extraction you control

Installing and Using Each

Docling

pip install docling
from docling.document_converter import DocumentConverter

result = DocumentConverter().convert("report.pdf")
print(result.document.export_to_markdown())

One call gets you Markdown with headings, lists, and tables already formatted.

pdfplumber

pip install pdfplumber
import pdfplumber

with pdfplumber.open("report.pdf") as pdf:
    for page in pdf.pages:
        text = page.extract_text()      # plain text, no structure
        tables = page.extract_tables()  # rows as lists, no pipe syntax
        # You still need to turn this into Markdown yourself

pdfplumber gets you the raw material; Docling gets you the finished document.

Table Extraction: AI Model vs Character Geometry

Both libraries are genuinely strong at tables, just through different mechanisms. Docling's table-structure model is trained to recognize row and column boundaries even in borderless or irregularly spaced tables, and it exports them directly as Markdown pipe tables. pdfplumber reconstructs tables from the literal x/y coordinates of each character, which makes it extremely accurate on documents where you can tune the extraction settings per table shape — but that tuning is manual, and the output is a Python list of lists, not Markdown, until you format it. For a deeper look at strategies for either approach, see our guide on extracting tables from PDFs to Markdown.

Scanned PDFs and OCR

This is the sharpest practical difference. Docling includes OCR for scanned pages and image-based PDFs as part of its standard pipeline — no extra setup required. pdfplumber has no OCR at all; it only reads text that's already embedded in the PDF's text layer, so a scanned contract or a photographed invoice returns nothing useful without pairing it with an engine like Tesseract. If your document set includes any scans, that alone can decide the comparison. See our guide to converting scanned PDFs to Markdown for more on handling that case, or use the file2markdown.ai converter, which runs OCR automatically on scanned input.

When to Use Each

Use Docling when:

  • You want Markdown output without writing your own formatting logic
  • Your documents mix scanned and native pages
  • You're feeding a RAG pipeline and want structure-aware chunks, not just raw text
  • You can afford the larger local install (layout and table models)

Use pdfplumber when:

  • You need exact character coordinates for custom layout or form-field logic
  • Your tables have unusual geometry that benefits from manual tuning
  • You want a lightweight, pure-Python dependency with no model downloads
  • You're comfortable writing your own Markdown reconstruction step

For how pdfplumber stacks up against a faster, general-purpose extractor, see pdfplumber vs PyMuPDF. For how Docling compares to other structure-aware parsers, see Docling vs Unstructured, Docling vs MarkItDown, and pymupdf4llm vs Docling.

When Neither Is Enough

Both are solid libraries, but real document pipelines run into the same walls regardless of which one you pick:

  • Non-Python environments — neither exposes a REST API, so calling them from a Node, Go, or Ruby service means standing up a Python microservice first
  • Mixed batch processing — a folder with native PDFs, scans, DOCX, and PPTX files needs per-type handling with either library
  • Maintenance — Docling's models and pdfplumber's parsing edge cases both need occasional updates as PDFs get weirder

The file2markdown.ai API converts PDFs — scanned or native — to clean Markdown with a single HTTP call, from any language, with OCR and table formatting handled server-side. If you're prototyping with Docling or pdfplumber and want to compare against a zero-setup baseline, it's worth including in the benchmark.

Frequently Asked Questions

Which is better for converting PDFs to Markdown: Docling or pdfplumber?

Docling is better for direct Markdown output — it has a built-in export_to_markdown() method that handles headings, lists, and tables automatically. pdfplumber gives you precise raw text and table data but no Markdown formatting; you have to build that layer yourself.

Can pdfplumber handle scanned PDFs?

No. pdfplumber only reads text already embedded in a PDF's text layer and has no OCR capability. For scanned documents you need to pair it with an OCR engine like Tesseract, or use a tool with OCR built in, such as Docling or file2markdown.ai.

Are Docling and pdfplumber both free to use commercially?

Yes. Both are MIT-licensed open-source projects, so there's no licensing restriction on using either in a commercial product — unlike some PDF libraries that use AGPL and require a paid license for closed-source commercial use.

Which library is better for financial tables and invoices?

Both handle tables well, but for different reasons. pdfplumber's character-coordinate approach is excellent when you can tune extraction settings per document type, which suits standardized forms like invoices. Docling's AI table model generalizes better across varied, unpredictable table layouts without per-document tuning, which suits mixed document sets like financial reports and filings.

Bottom Line

Pick Docling when you want ready-to-use, structure-aware Markdown and built-in OCR with minimal glue code. Pick pdfplumber when you need low-level control over text and table extraction and you're willing to build the Markdown layer yourself. If you'd rather skip both installs, file2markdown.ai converts PDFs to Markdown with OCR included through a free online converter or REST API.

The Markdown Memo

A fortnightly note for lawyers, researchers, accountants, and anyone else drowning in PDFs, scans, and decks. No spam.