Skip to main content

pdf2dotmd

A Python CLI tool that converts PDF files to Markdown format with intelligent layout analysis.

Features

  • Layout-aware text extraction — reconstructs logical reading order from PDF spatial data
  • Multi-column detection — handles two-column and multi-column layouts
  • Table extraction — converts PDF tables to Markdown pipe tables
  • Heading inference — detects headings from font size hierarchy
  • Header/footer filtering — automatically removes repeated page headers and footers
  • Image extraction — extracts embedded images to an assets/ directory
  • Ignore images mode — --ignore-images flag for text-only output
  • Page range selection — convert specific pages only
  • Batch conversion — process multiple PDF files with wildcards

Installation

pip install pdf2dotmd

Usage

# Output to stdout
pdf2dotmd input.pdf

# Output to file
pdf2dotmd input.pdf -o output.md

# Skip images, output single Markdown file
pdf2dotmd input.pdf --ignore-images

# Batch conversion
pdf2dotmd *.pdf -o output_dir/

# Convert only specific pages
pdf2dotmd input.pdf -p 1-3
pdf2dotmd input.pdf -p 1-5,8,10-12

# Verbose logging
pdf2dotmd input.pdf -v

Backends & Plugins

The default install is lightweight (pdfplumber only) and converts born-digital PDFs. For scanned PDFs (OCR), complex layouts, and borderless/complex tables, install the optional docling backend (TableFormer + DocLayNet + OCR). It requires Python >=3.10.

# List available and installed backends
pdf2dotmd plugin list

# Install the docling backend (runs pip install pdf2dotmd[docling])
pdf2dotmd plugin install docling

# Show details / uninstall
pdf2dotmd plugin info docling
pdf2dotmd plugin uninstall docling

Once installed, choose a backend explicitly or let auto pick:

# Use docling directly
pdf2dotmd scanned.pdf --backend docling -o out.md

# auto (default): born-digital PDFs use pdfplumber; scanned PDFs use docling
pdf2dotmd document.pdf -o out.md

Third-party packages can register their own backend via the pdf2dotmd.backends entry-point group — they appear in plugin list automatically.

How It Works

  1. Character extraction — uses pdfplumber to extract individual characters with position data
  2. Line grouping — clusters characters into text lines by y-coordinate proximity
  3. Block formation — groups lines into paragraphs based on horizontal alignment and vertical spacing
  4. Column detection — identifies multi-column layouts by analyzing horizontal text density gaps
  5. Reading order — sorts blocks top-to-bottom, left-to-right, handling spanning titles
  6. Header/footer removal — detects repeated elements across pages
  7. Heading inference — maps font sizes to heading levels (H1-H6)

Limitations

  • Scanned PDFs (default backend) — the default pdfplumber backend has no OCR; scanned/image-only PDFs produce empty output. Install the docling backend (pdf2dotmd plugin install docling, Python >=3.10) to add OCR.
  • Encrypted PDFs — password-protected PDFs are not supported
  • Complex layouts — the default backend may not parse highly irregular layouts perfectly; the docling backend handles these better

License

MIT

Metadata

Release files for pdf2dotmd 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf2dotmd 0.0.2
File Size Uploaded
pdf2dotmd-0.0.2.tar.gz 29.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf2dotmd 0.0.2
File Interpreter ABI Platform
pdf2dotmd-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 63.1 kB

Release files / pdf2dotmd-0.0.2.tar.gz

Download URL pdf2dotmd-0.0.2.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a858b9e43b45f2d0b4a49f674f21935c68a014fcba22912a589c00768441218d
BLAKE2b-256 checksum
How to use checksums
baab2b04373ef5e3255810de5b8b414518a70330bcbb1289c5449869962805e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / pdf2dotmd-0.0.2-py3-none-any.whl

Download URL pdf2dotmd-0.0.2-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bab659519f5222a6c0694567cace003fe62f746b17c780bfecaf9c78501bd4a
BLAKE2b-256 checksum
How to use checksums
68f4b53af14126eabd56a792e5b7086d2eb73affa57c2879643797b36f51f479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page