opendataloader-project / opendataloader-pdf
opendataloader-project / opendataloader-pdf
OpenDataLoader PDF is a PDF parser designed for AI-ready data. It automates PDF accessibility and is open-source. 🔍 This PDF parser is built for AI data extraction—allowing you to extract Markdown, JSON (with bounding boxes), and HTML from any PDF. It ranks #1 in benchmarks (0.907 overall) and features a deterministic local mode alongside an AI hybrid mode for complex pages. OpenDataLoader PDF 是一款专为 AI 数据准备的 PDF 解析器。它能实现 PDF 无障碍处理自动化,且完全开源。🔍 该解析器专为 AI 数据提取而生,可从任何 PDF 中提取 Markdown、JSON(含边界框)和 HTML。它在基准测试中排名第一(综合得分 0.907),并提供确定性本地模式以及针对复杂页面的 AI 混合模式。
How accurate is it? — #1 in benchmarks: 0.907 overall, 0.928 table accuracy across 200 real-world PDFs, including multi-column and scientific papers. It uses a deterministic local mode + AI hybrid mode for complex pages. 准确度如何?— 在基准测试中排名第一:综合得分 0.907,在涵盖多栏排版和科学论文的 200 份真实 PDF 文档中,表格识别准确率达到 0.928。它通过确定性本地模式与 AI 混合模式处理复杂页面。
Scanned PDFs and OCR? — Yes. It features built-in OCR (80+ languages) in hybrid mode and works with poor-quality scans at 300 DPI+ (in hybrid mode). 扫描版 PDF 和 OCR?— 支持。混合模式内置 OCR(支持 80 多种语言),并可在混合模式下处理 300 DPI 以上的低质量扫描件。
Tables, formulas, images, charts? — Yes. It handles complex/borderless tables, LaTeX formulas, and AI-generated picture/chart descriptions, all via hybrid mode. 表格、公式、图像和图表?— 支持。通过混合模式,可处理复杂/无边框表格、LaTeX 公式以及 AI 生成的图片/图表描述。
How do I use this for RAG? — pip install opendataloader-pdf, convert in 3 lines. It outputs structured Markdown for chunking, JSON with bounding boxes for source citations, and HTML. LangChain integration is available. Python, Node.js, and Java SDKs are provided.
如何将其用于 RAG?— 执行 pip install opendataloader-pdf,仅需 3 行代码即可完成转换。它输出用于分块的结构化 Markdown、用于源引用的带边界框 JSON 以及 HTML。支持 LangChain 集成,并提供 Python、Node.js 和 Java SDK。
♿ PDF accessibility automation — Auto-tag untagged PDFs into screen-reader-ready Tagged PDFs at scale. It is the first open-source tool to generate Tagged PDFs end-to-end. ♿ PDF 无障碍自动化 — 可大规模将无标签 PDF 自动转换为适配屏幕阅读器的“标签化 PDF”(Tagged PDF)。这是首个实现端到端生成标签化 PDF 的开源工具。
What’s the problem? — Accessibility regulations are now enforced worldwide. Manual PDF remediation costs $50–200 per document and doesn’t scale. 存在什么问题?— 全球范围内无障碍法规正在强制执行。手动修复 PDF 的成本高达每份文档 50–200 美元,且无法规模化。
What’s free? — Layout analysis + auto-tagging (Apache 2.0). Untagged PDF in → Tagged PDF out. No proprietary SDK dependency. 哪些功能免费?— 版面分析 + 自动打标签(基于 Apache 2.0 协议)。输入无标签 PDF,输出标签化 PDF,无需依赖任何专有 SDK。
What about PDF/UA compliance? — Converting Tagged PDF to PDF/UA-1 or PDF/UA-2 is an enterprise add-on. Auto-tagging generates the Tagged PDF; PDF/UA export is the final step. 关于 PDF/UA 合规性?— 将标签化 PDF 转换为 PDF/UA-1 或 PDF/UA-2 属于企业级附加功能。自动打标签生成的是标签化 PDF,而 PDF/UA 导出是流程的最后一步。
Why trust this? — Built in collaboration with Dual Lab (veraPDF developers) based on PDF Association specifications, best practice guides, and the expertise of the PDF Community. Auto-tagging follows the Well-Tagged PDF specification, validated with veraPDF. 为何值得信赖?— 本项目与 Dual Lab(veraPDF 开发商)合作开发,基于 PDF 协会规范、最佳实践指南以及 PDF 社区的专业知识。自动打标签功能遵循“良好标签 PDF”(Well-Tagged PDF)规范,并经由 veraPDF 验证。
Get Started in 30 Seconds
30 秒快速上手
Requires: Java 11+ and Python 3.10+ (Node.js | Java also available). 要求:Java 11+ 和 Python 3.10+(同时提供 Node.js 和 Java 版本)。
Before you start: run java -version. If not found, install JDK 11+ from Adoptium.
开始前:运行 java -version。如果未找到,请从 Adoptium 安装 JDK 11+。
pip install -U opendataloader-pdf
import opendataloader_pdf
# Batch all files in one call — each convert() spawns a JVM process, so repeated calls are slow
opendataloader_pdf.convert(
input_path=["file1.pdf", "file2.pdf", "folder/"],
output_dir="output/",
format="markdown,json"
)
Annotated PDF output — each element (heading, paragraph, table, image) is detected with bounding boxes and semantic type. 带标注的 PDF 输出 — 每个元素(标题、段落、表格、图像)均通过边界框和语义类型进行检测。
What Problems Does This Solve?
它解决了哪些问题?
| Problem | Solution | Status |
|---|---|---|
| PDF structure lost during parsing (wrong reading order, broken tables, no coordinates) | Deterministic local PDF to Markdown/JSON with bounding boxes, XY-Cut++ reading order | Shipped |
| Complex tables, scanned PDFs, formulas, charts need AI-level understanding | Hybrid mode routes complex pages to AI backend (#1 in benchmarks) | Shipped |
| Manual PDF remediation cost (Accessibility regulations like EAA, ADA, Section 508) | Auto-tag untagged PDFs into Tagged PDFs (free, Apache 2.0). Foundation for PDF/UA workflows | Auto-tag: Shipped. PDF/UA export: Enterprise |
| 问题 | 解决方案 | 状态 |
|---|---|---|
| 解析过程中 PDF 结构丢失(阅读顺序错误、表格损坏、无坐标) | 确定性本地 PDF 转 Markdown/JSON(含边界框),采用 XY-Cut++ 阅读顺序 | 已发布 |
| 复杂表格、扫描版 PDF、公式、图表需要 AI 级理解 | 混合模式将复杂页面路由至 AI 后端(基准测试排名第一) | 已发布 |
| 手动修复 PDF 成本高(EAA、ADA、Section 508 等无障碍法规要求) | 将无标签 PDF 自动转换为标签化 PDF(免费,Apache 2.0)。为 PDF/UA 工作流奠定基础 | 自动打标签:已发布;PDF/UA 导出:企业版 |
Capability Matrix
功能矩阵
| Capability | Supported | Tier |
|---|---|---|
| Data extraction (text with correct reading order) | Yes | Free |
| Bounding boxes for every element | Yes | Free |
| Table extraction (simple borders) | Yes | Free |
| Table extraction (complex/borderless) | Yes | Free (Hybrid) |
| Heading hierarchy detection | Yes | Free |
| List detection (numbered, bulleted, nested) | Yes | Free |
| Image extraction with coordinates | Yes | Free |
| AI chart/image description | Yes | Free (Hybrid) |
| OCR for scanned PDFs | Yes | Free (Hybrid) |
| Formula extraction (LaTeX) | Yes | Free (Hybrid) |
| Tagged PDF structure extraction | Yes | Free |
| AI safety (prompt injection filtering) | Yes | Free |
| Header/footer/watermark filtering | Yes | Free |
| Accessibility (Auto-tagging) | Yes | Free (Apache 2.0) |
| PDF/UA-1, PDF/UA-2 export | 💼 | Available Enterprise |
| 功能 | 支持 | 等级 |
|---|---|---|
| 数据提取(带正确阅读顺序的文本) | 是 | 免费 |
| 每个元素的边界框 | 是 | 免费 |
| 表格提取(简单边框) | 是 | 免费 |
| 表格提取(复杂/无边框) | 是 | 免费(混合模式) |
| 标题层级检测 | 是 | 免费 |
| 列表检测(编号、项目符号、嵌套) | 是 | 免费 |
| 带坐标的图像提取 | 是 | 免费 |
| AI 图表/图像描述 | 是 | 免费(混合模式) |
| 扫描版 PDF 的 OCR | 是 | 免费(混合模式) |
| 公式提取 (LaTeX) | 是 | 免费(混合模式) |
| 标签化 PDF 结构提取 | 是 | 免费 |
| AI 安全(提示词注入过滤) | 是 | 免费 |
| 页眉/页脚/水印过滤 | 是 | 免费 |
| 无障碍(自动打标签) | 是 | 免费(Apache 2.0) |
| PDF/UA-1, PDF/UA-2 导出 | 💼 | 企业版可用 |
Extraction Benchmarks
提取基准测试
opendataloader-pdf [hybrid] ranks #1 overall (0.907) across reading order, table, and heading extraction accuracy. opendataloader-pdf [混合模式] 在阅读顺序、表格和标题提取准确率方面综合排名第一 (0.907)。
(Note: The original table data is provided in the source text; please refer to the provided benchmark table for specific engine comparisons.) (注:原文提供了详细的基准测试表格,请参考原文中的数据进行各引擎对比。)
Which Mode Should I Use?
我应该使用哪种模式?
| Your Document | Mode | Install | Server Command | Client Command |
|---|---|---|---|---|
| Standard digital PDF | Fast (default) | pip install opendataloader-pdf | None needed | opendataloader-pdf file1.pdf ... |
| Complex/nested tables | Hybrid | pip install "opendataloader-pdf[hybrid]" | opendataloader-pdf-hybrid --port 5002 | opendataloader-pdf --hybrid ... |
| Scanned/image-based PDF | Hybrid + OCR | pip install "opendataloader-pdf[hybrid]" | ... --force-ocr | opendataloader-pdf --hybrid ... |
| 您的文档类型 | 模式 | 安装命令 | 服务端命令 | 客户端命令 |
|---|---|---|---|---|
| 标准数字 PDF | 快速(默认) | pip install opendataloader-pdf | 无需 | opendataloader-pdf file1.pdf ... |
| 复杂/嵌套表格 | 混合 | pip install "opendataloader-pdf[hybrid]" | opendataloader-pdf-hybrid --port 5002 | opendataloader-pdf --hybrid ... |
| 扫描/图像 PDF | 混合 + OCR | pip install "opendataloader-pdf[hybrid]" | ... --force-ocr | opendataloader-pdf --hybrid ... |