# oteyjo/pdf-extract architecture

> Architecture diagram of the GitHub repository oteyjo/pdf-extract, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oteyjo/pdf-extract
- Repository: https://github.com/oteyjo/pdf-extract

## Overview

This is a compact PDF extraction utility centered on `PDFExtractor`. The user supplies a PDF and extraction options; the extractor partitions the PDF, processes recognized elements, writes content and document metadata, and returns counts. Text, titles, tables, images, and element metadata are handled within the same source file. The README documents these output capabilities; the graph shows the implementation relationships visible in the excerpt.

Main entry points: [`pdf_extract.py`](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py) (PDF extractor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extraction["Extraction"]
  node_extractor["PDF extractor<br/>[pdf_extract.py]"]
  node_partitioner["PDF partitioner"]
  node_element_processing["Element processing<br/>[pdf_extract.py]"]
  node_metadata_extraction["Element metadata<br/>[pdf_extract.py]"]
end

subgraph group_outputs["Outputs"]
  node_content_outputs["Extracted files<br/>[pdf_extract.py]"]
  node_statistics["Extraction statistics<br/>[pdf_extract.py]"]
end

node_user(("User"))

node_user -->|"requests extraction"| node_extractor
node_extractor -->|"partitions PDF"| node_partitioner
node_extractor -->|"processes elements"| node_element_processing
node_element_processing -->|"extracts metadata"| node_metadata_extraction
node_element_processing -->|"writes content"| node_content_outputs
node_extractor -->|"writes document metadata"| node_content_outputs
node_extractor -->|"returns counts"| node_statistics

click node_extractor "https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py"
click node_element_processing "https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py"
click node_metadata_extraction "https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py"
click node_content_outputs "https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py"
click node_statistics "https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extractor,node_partitioner,node_element_processing,node_metadata_extraction,node_user toneBlue
class node_content_outputs,node_statistics toneAmber
```

## Components

### Extraction

- [PDF extractor](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py): `pdf_extract.py`
- **PDF partitioner**
- [Element processing](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py): `pdf_extract.py`
- [Element metadata](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py): `pdf_extract.py`

### Outputs

- [Extracted files](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py): `pdf_extract.py`
- [Extraction statistics](https://github.com/oteyjo/pdf-extract/blob/main/pdf_extract.py): `pdf_extract.py`

### Other components

- **User**

## Connections

- User → PDF extractor: requests extraction (evidence: `README.md`)
- PDF extractor → PDF partitioner: partitions PDF (evidence: `pdf_extract.py`)
- PDF extractor → Element processing: processes elements (evidence: `pdf_extract.py`)
- Element processing → Element metadata: extracts metadata (evidence: `pdf_extract.py`)
- Element processing → Extracted files: writes content (evidence: `pdf_extract.py`)
- PDF extractor → Extracted files: writes document metadata (evidence: `pdf_extract.py`)
- PDF extractor → Extraction statistics: returns counts (evidence: `pdf_extract.py`)
