百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pdf-to-markdown

> 数据库
开源

将 PDF 转换为清晰、结构化的 Markdown

198 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

将 PDF 转换为清晰、结构化的 Markdown

PDF to Markdown

Turn PDFs into clean, structured Markdown

pdf2md extracts a PDF's structure - headings, lists, tables, code, math, links, and images - not just its raw text. It is built on the MIT-licensed pdfplumber / pdfminer.six, with no AGPL (PyMuPDF) and no heavy ML/OCR stack anywhere in the dependency tree. Install, import, and run it as pdf2md.

Install

bash
uv sync

Usage

bash
uv run pdf2md --pdf_path paper.pdf --out out/
# → writes out/paper.md; extracted images land in out/ and are linked relative to the .md

Features

  • Headings from document-wide font-size statistics
  • Text: paragraphs (de-hyphenated), bold / italic / inline code, super/subscript, links
  • Lists (ordered, unordered, nested), blockquotes, horizontal rules
  • Code blocks via monospace-font detection
  • Tables - ruled and borderless, as GFM pipe tables
  • Math → LaTeX - inline $…$ and display $$…$$ (heuristic)
  • Layout - multi-column reading order, rotated/landscape pages, header/footer stripping
  • Footnotes, table of contents, images, and CJK / Unicode text

Behaviour is tunable in config/config.yaml.

Optional: high-accuracy math

Core math extraction is heuristic. For accurate equations, install the opt-in ML extra (pix2tex, which pulls in BSD torch - kept out of the core so the default install stays lean):

bash
uv sync --extra math

Optional: progress bar

Every step of the pipeline reports itself, so a long conversion is never a black box. Steps that walk the pages get a bar; one-off steps print a [pdf2md] line:

[pdf2md] features on: images, borderless tables, blockquotes, footnotes, bold headings
extracting images: 100%|##########| 1477/1477 [01:33 0` is
per-page progress, `total == 0` is a one-off step. The pipeline never imports
tqdm itself, so nothing is pulled in unless you ask for it:

```python
from pdf2md import PdfToMarkdown

PdfToMarkdown(progress=lambda stage, done, total: print(stage, done, total))

Limitations

  • No OCR - scanned / image-only pages yield embedded images only.
  • Math is heuristic - complex equations are best-effort (use --extra math).
  • Dense multi-table pages and right-to-left scripts may need manual review.

License

MIT - see LICENSE.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythondocument-conversiondocument-processinginformation-retrievalpdf-converter

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库