This solution extracts a structured outline from a given PDF, including:
- Document Title
- Headings at H1, H2, and H3 levels
- Page numbers for each heading
It generates a clean JSON output representing the hierarchy of the document. This is the first step toward building intelligent, interactive PDF experiences for the “Connecting the Dots” challenge.
PDFs are ubiquitous but lack machine-readable structure. This makes them difficult to navigate, analyze, or summarize programmatically.
By building a reliable outline extractor:
- We enable smart navigation
- We pave the way for semantic search and persona-driven insight
- We create the foundation for futuristic document readers (Round 2 & 1B)
- ✅ Parses any PDF up to 50 pages
- ✅ Detects Title, H1, H2, H3 with page numbers
- ✅ Outputs clean, schema-compliant JSON
- ✅ Heuristic-based heading detection
- ✅ Runs in a Docker container (CPU-only, offline)
- ✅ Fully compliant with Adobe Hackathon constraints
| Module | Responsibility |
|---|---|
extract.py |
Extract text, font size, and positions |
classify.py |
Classify headings using layout heuristics |
main.py |
Entry point: Processes all PDFs in /input |
utils.py |
JSON writing and helper functions |
- Font Size-Based Classification: Top 3 font sizes are mapped to H1, H2, H3
- Short Line Filter: Ignores long paragraphs
- Title Detection: First H1 encountered is treated as the title
- Position-Aware: Headings tend to appear near top/left
{
"title": "Understanding AI",
"outline": [
{ "level": "H1", "text": "Introduction", "page": 1 },
{ "level": "H2", "text": "What is AI?", "page": 2 },
{ "level": "H3", "text": "History of AI", "page": 3 }
]
}