A Python tool that extracts structured content (paragraphs, tables, charts) from PDF documents and converts it into a hierarchical JSON format.
Built using:
- Streamlit – Interactive UI
- pdfplumber – Text & table extraction
- PyMuPDF (fitz) – Chart/image detection
- pandas – Table rendering in UI
- Extracts:
- 📝 Paragraphs with section/subsection context
- 📊 Tables (structured data)
- 📈 Charts (embedded images)
- Maintains page-level hierarchy
- Exports clean, well-structured JSON
- Interactive Streamlit web interface
- Download extracted JSON directly
git clone <your-repo-url>
cd <your-repo-folder>python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windowspip install -r requirements.txtstreamlit run app.py- Upload a PDF file (resume, factsheet, etc.)
- Click Process PDF
- Preview extracted content (page-wise)
- Download the JSON output
.
├── app.py # Streamlit web app
├── pdf_parser.py # Core parser (paragraph, table, chart extraction)
├── utils/
│ └── styling.py # Custom CSS for Streamlit UI
├── requirements.txt # Python dependencies
└── README.md # Project instructions
{
"pages": [
{
"page_number": 1,
"content": [
{
"type": "paragraph",
"section": "FACTSHEET",
"sub_section": null,
"text": "June 2025 Mutual Fund investments are subject to market risks..."
},
{
"type": "chart",
"section": "FACTSHEET",
"sub_section": null,
"description": "Embedded image detected - possible chart",
"image_index": 1
},
{
"type": "table",
"section": "Financial Data",
"sub_section": null,
"table_data": [
["Year", "Revenue", "Profit"],
["2022", "$10M", "$2M"]
]
}
]
}
]
}- Paragraphs are detected using regex-based section/subsection rules.
- Tables are extracted only if the PDF has true tabular structures.
- Charts are flagged when images are found (exported as metadata, not raw image files).
- For scanned PDFs, OCR (e.g., Tesseract) would be required (not included here).
- Input: PDF → Output: JSON
- Maintains page hierarchy
- Detects paragraphs, tables, charts
- Preserves sections & subsections
- Exportable JSON + Streamlit UI