跳到主要内容

PDF识别提取专家

收藏0

PDF/图片/扫描件 OCR 提取文字转 Markdown。支持 PP-OCRv6 三档模型,适合合同、发票、中文扫描件等。灵栈搬运自 SkillHub pdf-ocr-md v3.4.0。

让 AI 安装

Minsaroun最新版本 0.1.0更新于 2026-11-04下载 0 次

references/opendataloader.md

2.9 KB查看排版效果
1# OpenDataLoader PDF Integration — Reference
2
3> Text-layer PDF parsing: JSON with bounding boxes, Markdown, HTML, Text, Tagged PDF.
4> Supports table detection, reading order (XY-Cut++), sanitization.
5
6## Environment
7
8Requires Java 11+ and the `opendataloader-pdf` PyPI package (~21.5MB, includes 23MB Java CLI JAR).
9
10```bash
11java -version 2>&1 | head -1 # must be 11+
12python3 -c "import opendataloader_pdf; print('✅')" 2>&1 || echo "⚠️ not installed"
13```
14
15### Installation
16
17```bash
18# 1. Java (if missing)
19sudo apt-get install -y -qq default-jre
20
21# 2. Python SDK (use Tsinghua mirror for speed — official PyPI often times out)
22python3 -m venv ~/.venvs/opendataloader
23~/.venvs/opendataloader/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opendataloader-pdf
24
25# 3. Optional: add to PATH
26ln -sf ~/.venvs/opendataloader/bin/opendataloader-pdf ~/.local/bin/
27```
28
29**Key Finding**: Official PyPI (files.pythonhosted.org) downloads frequently time out; Tsinghua mirror delivers at 60+ MB/s.
30
31## CLI Usage
32
33```bash
34# Basic: JSON + Markdown
35opendataloader-pdf input.pdf -f json,markdown -o ./output_dir
36
37# All formats
38opendataloader-pdf input.pdf -f json,markdown,html,text,tagged-pdf -o ./output_dir
39
40# Stdout (single format only)
41opendataloader-pdf input.pdf -f markdown --to-stdout 2>/dev/null
42
43# Page range
44opendataloader-pdf input.pdf -f json -o ./output --pages "1,3,5-7"
45
46# Sanitize (redact emails, phones, bank card numbers)
47opendataloader-pdf input.pdf -f json -o ./output --sanitize
48
49# Table detection mode
50opendataloader-pdf input.pdf -f json -o ./output --table-method cluster
51
52# Keep original line breaks
53opendataloader-pdf input.pdf -f markdown -o ./output --keep-line-breaks
54```
55
56## Python SDK
57
58```python
59from opendataloader_pdf import convert
60convert(
61 "/path/to/contract.pdf",
62 output_dir="/path/to/output",
63 format="json,markdown,html",
64 reading_order="xycut", # XY-Cut++ reading order (default)
65 table_method="default", # or "cluster"
66 pages="1,3,5-7",
67 sanitize=False,
68 keep_line_breaks=False
69)
70```
71
72## Output Formats
73
74| Format | Content | Use Case |
75|--------|---------|----------|
76| `json` | type/hierarchy/content/bounding box/font/size/color per element | Programmatic processing, positional traceability |
77| `markdown` | Structured text with headings, lists, tables | LLM input, quick reading |
78| `html` | Layout-preserving page | Web preview |
79| `text` | Plain text | Search, simple analysis |
80| `tagged-pdf` | Tagged PDF | Accessibility (PDF/UA) |
81
82## Performance
83
84- **Local deterministic mode**: ~0.015s/page (pure Java, no API calls)
85- **AI hybrid mode**: Complex pages (OCR) need extra Hybrid service
86- **No network required**: Local mode fully offline
87- **23MB JAR**: Large initial download
88
89## Limitations
90
91- Source PDF must have extractable text layer (scanned docs need PaddleOCR path — see main pdf-ocr-md skill)
92- Scanned OCR recommended path: PaddleOCR (Chinese) or OpenDataLoader hybrid mode

文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。