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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2dotmd-0.0.2.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf2dotmd-0.0.2-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file pdf2dotmd-0.0.2.tar.gz.

File metadata

  • Download URL: pdf2dotmd-0.0.2.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pdf2dotmd-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a858b9e43b45f2d0b4a49f674f21935c68a014fcba22912a589c00768441218d
MD5 b7576957994d1612ba651cdfe305012b
BLAKE2b-256 baab2b04373ef5e3255810de5b8b414518a70330bcbb1289c5449869962805e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdf2dotmd-0.0.2.tar.gz:

Publisher: publish-pypi.yml on hnrobert/pdf2dotmd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdf2dotmd-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pdf2dotmd-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pdf2dotmd-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1bab659519f5222a6c0694567cace003fe62f746b17c780bfecaf9c78501bd4a
MD5 01b8607b3b72aba9df1e0057c3831691
BLAKE2b-256 68f4b53af14126eabd56a792e5b7086d2eb73affa57c2879643797b36f51f479

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdf2dotmd-0.0.2-py3-none-any.whl:

Publisher: publish-pypi.yml on hnrobert/pdf2dotmd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page