Introduction to OpenDataLoader
OpenDataLoader PDF is an open-source PDF parser that ranks #1 in extraction accuracy across independent benchmarks. It extracts structured data from PDFs with bounding boxes, making it perfect for RAG pipelines, document analysis, and AI applications.
Why OpenDataLoader?
| Feature | Benefit |
|---|---|
| #1 Accuracy | 0.907 overall score, 0.928 table accuracy |
| Bounding Boxes | Every element has coordinates for source citations |
| No GPU Required | Runs locally on any machine |
| Hybrid Mode | AI-powered extraction for complex documents |
| Open Source | Apache 2.0 license |
Benchmark Results
| Parser | Overall | Tables | Speed |
|------------------------|---------|--------|----------|
| OpenDataLoader [hybrid] | 0.907 | 0.928 | 0.46s/pg |
| docling | 0.882 | 0.887 | 0.76s/pg |
| marker | 0.861 | 0.808 | 53.9s/pg |
| pymupdf4llm | 0.732 | 0.401 | 0.09s/pg |
Installation
Step 1: Verify Java
OpenDataLoader requires Java 11 or higher:
java -version
If not installed, download from [Adoptium](https://adoptium.net/).
Step 2: Install the Python SDK
pip install -U opendataloader-pdf
Your First Conversion
Create a simple Python script:
import opendataloader_pdf
# Convert a PDF to Markdown and JSON
opendataloader_pdf.convert(
input_path="document.pdf",
output_dir="output/",
format="markdown,json"
)
This creates two files in output/:
document.md- Clean Markdown textdocument.json- Structured data with coordinates
Output Formats
OpenDataLoader supports multiple output formats:
| Format | Use Case |
|---|---|
markdown | Clean text for LLM context windows |
json | Structured data with bounding boxes |
html | Web display with styling |
text | Plain text extraction |
pdf | Annotated PDF (visual debugging) |
Combining Formats
opendataloader_pdf.convert(
input_path="document.pdf",
output_dir="output/",
format="markdown,json,html" # Multiple formats
)
Understanding JSON Output
The JSON output contains rich metadata:
{
"file name": "document.pdf",
"number of pages": 5,
"kids": [
{
"type": "heading",
"level": 1,
"page number": 1,
"bounding box": [72.0, 700.0, 540.0, 730.0],
"content": "Introduction"
},
{
"type": "paragraph",
"page number": 1,
"bounding box": [72.0, 650.0, 540.0, 690.0],
"content": "This is the first paragraph..."
}
]
}
Key Fields
- type: Element type (heading, paragraph, table, list, image)
- bounding box:
[left, bottom, right, top]in PDF points - page number: 1-indexed page reference
- content: Extracted text
Challenge: Element Counter
Write a script that:
- Converts a PDF to JSON
- Counts elements by type (headings, paragraphs, tables, etc.)
- Prints a summary report
import opendataloader_pdf
import json
# Your code here:
# 1. Convert a sample PDF
# 2. Load the JSON output
# 3. Count elements by type
# 4. Print results
Expected output:
Element Summary:
- headings: 12
- paragraphs: 45
- tables: 3
- images: 2
Total elements: 62