pdf2md-workflow
一个组件化的 PDF 转 Markdown 工作流工具,支持批量处理和 AI 智能格式化。
✨ 特性
- 📄 PDF 文本提取 - 基于 PyMuPDF 的高效文本提取
- 📊 表格提取 - 使用 pdfplumber 提取 PDF 表格
- 🔄 批量处理 - 支持批量转换多个 PDF 文件
- 🤖 AI 格式化 - 配合 markdown-formatter skill 智能格式化
- 📦 Python 包 - 可通过 pip 安装使用
- 🛠️ CLI 工具 - 提供命令行接口
📦 安装
pip install pdf2md-workflow
或从源码安装:
git clone https://github.com/Drehabwen/Openrehab-vibepaper-read.git
cd Openrehab-vibepaper-read
pip install -e .
🚀 快速开始
命令行使用
# 转换单个 PDF
pdf2md convert paper.pdf
# 批量转换
pdf2md batch ./pdfs -o ./output
# 使用配置文件
pdf2md batch ./pdfs -c config.yaml
Python API 使用
from pdf2md_workflow import convert_pdf, Config
# 简单转换
convert_pdf("paper.pdf", "output.md")
# 使用配置
config = Config.from_yaml("config.yaml")
convert_pdf("paper.pdf", "output.md", config=config)
📁 项目结构
pdf2md_workflow/
├── __init__.py # 包入口
├── cli.py # 命令行接口
├── config.py # 配置管理
├── extractors.py # PDF 提取器
├── formatter.py # Markdown 格式化
└── processor.py # 批量处理器
⚙️ 配置
创建 config.yaml 文件:
input_directories:
- "./pdfs"
output_directory: "./output"
extractor: "pymupdf" # pymupdf 或 pdfplumber
preserve_images: true
🔧 依赖
- Python >= 3.8
- PyMuPDF >= 1.23.0
- pdfplumber >= 0.10.0
- PyYAML >= 6.0
📝 使用示例
转换学术论文
from pdf2md_workflow import convert_pdf
# 转换 PDF 论文
convert_pdf(
"research_paper.pdf",
"research_paper.md",
extractor="pymupdf"
)
批量处理
from pdf2md_workflow import PDFProcessor, Config
config = Config(
input_directories=["./papers"],
output_directory="./markdown"
)
processor = PDFProcessor(config)
processor.process_all()
🤝 配合 AI 格式化
本项目提供 markdown-formatter skill,可以配合 AI 工具进行智能格式化:
用户: 整理这个 Markdown 文件
AI: [调用 markdown-formatter skill 进行格式化]
📄 License
MIT License - 详见 LICENSE 文件
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📮 联系方式
Made with ❤️ by Drehabwen
Metadata
Release files for pdf2md-workflow 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdf2md_workflow-0.1.0.tar.gz | 15.8 kB | Without provenance | Details for pdf2md_workflow-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdf2md_workflow-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pdf2md_workflow-0.1.0-py3-none-any.whl |
Total release size: 26.6 kB
Release files / pdf2md_workflow-0.1.0.tar.gz
| Download URL | pdf2md_workflow-0.1.0.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64239fa800123d247e21874caf0fecc111dc3e8531aaf1fd6c2ad7f6b97740d3
|
|
BLAKE2b-256 checksum How to use checksums |
0b26608d4571c66ccbf8de4b0436019bc6dc796dad95eb87cd46e9bd24926153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / pdf2md_workflow-0.1.0-py3-none-any.whl
| Download URL | pdf2md_workflow-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63900f2862d5d1644d61107beea1dfab96e27607b4b6257b9a55206eba4476d0
|
|
BLAKE2b-256 checksum How to use checksums |
1b6a0f49fd201c1e0e1f0d01929449e5f3622a261ed025588a7d40e9cd30bdbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for pdf2md-workflow 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.