# christmardochee/pdf2word architecture

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

- Interactive diagram: https://gitdiagram.com/christmardochee/pdf2word
- Repository: https://github.com/christmardochee/pdf2word

## Overview

pdf2word converts PDFs into editable DOCX files through selectable conversion engines, with automatic document analysis and optional enhancement; it also offers DOCX-to-PDF reconversion and cloud-key management. The main conversion flow is supported by the orchestrator excerpt and README. Several engine implementations and routing details are unsampled, so their documented roles are shown without asserting additional internal call relationships.

Main entry points: [`pdf2word/converter.py`](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/converter.py) (Conversion orchestrator), [`pdf2word/cli.py`](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cli.py) (CLI), [`pdf2word/cloud_converter.py`](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cloud_converter.py) (Cloud conversion), [`pdf2word/ocr_converter.py`](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/ocr_converter.py) (OCR conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI<br/>[cli.py]"]
  node_api["Python API<br/>[converter.py]"]
end

subgraph group_routing["Conversion routing"]
  node_orchestrator["Conversion orchestrator<br/>[converter.py]"]
  node_analyzer["PDF analyzer<br/>[analyzer.py]"]
  node_enhancer["DOCX enhancer<br/>[docx_enhancer.py]"]
end

subgraph group_engines["Conversion engines"]
  node_smart["Smart conversion<br/>[smart_converter.py]"]
  node_docling["Docling conversion"]
  node_cloud["Cloud conversion<br/>[cloud_converter.py]"]
  node_msword["MS Word conversion"]
  node_libreoffice["LibreOffice conversion"]
  node_text["Text conversion<br/>[text_converter.py]"]
  node_ocr["OCR conversion<br/>[ocr_converter.py]"]
  node_hybrid["Hybrid conversion"]
  node_combined["Combined conversion"]
end

subgraph group_output["Output and settings"]
  node_docx["Output DOCX"]
  node_docx_pdf["DOCX to PDF<br/>[docx_to_pdf.py]"]
  node_key_config["API key settings<br/>[config.py]"]
  node_pdf_output["Output PDF"]
end

node_cli_user(("CLI user"))
node_python_user(("Python caller"))
node_input_pdf["Input PDF"]
node_cloud_service{{"ConvertAPI"}}
node_ocr_service{{"OCR engine"}}
node_key_store[("Stored API key")]

node_cli_user -->|"runs commands"| node_cli
node_python_user -->|"calls conversion"| node_api
node_cli -->|"starts conversion"| node_orchestrator
node_api -->|"invokes conversion"| node_orchestrator
node_orchestrator -->|"analyzes PDF"| node_analyzer
node_input_pdf -->|"reads PDF"| node_analyzer
node_orchestrator -->|"routes conversion"| node_smart
node_orchestrator -->|"routes conversion"| node_docling
node_orchestrator -->|"routes conversion"| node_cloud
node_orchestrator -->|"routes conversion"| node_msword
node_orchestrator -->|"routes conversion"| node_libreoffice
node_orchestrator -->|"routes conversion"| node_text
node_orchestrator -->|"routes conversion"| node_ocr
node_orchestrator -->|"routes conversion"| node_hybrid
node_orchestrator -->|"routes conversion"| node_combined
node_orchestrator -->|"post-processes DOCX"| node_enhancer
node_smart -->|"produces DOCX"| node_docx
node_docling -->|"produces DOCX"| node_docx
node_cloud -.->|"uses conversion API"| node_cloud_service
node_cloud -->|"produces DOCX"| node_docx
node_msword -->|"produces DOCX"| node_docx
node_libreoffice -->|"produces DOCX"| node_docx
node_text -->|"produces DOCX"| node_docx
node_ocr -.->|"recognizes text"| node_ocr_service
node_ocr -->|"produces DOCX"| node_docx
node_hybrid -->|"produces DOCX"| node_docx
node_combined -->|"produces DOCX"| node_docx
node_cli -->|"starts reconversion"| node_docx_pdf
node_docx_pdf -->|"produces PDF"| node_pdf_output
node_cli -->|"manages key"| node_key_config
node_key_config -->|"stores key"| node_key_store

click node_cli "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cli.py"
click node_api "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/converter.py"
click node_orchestrator "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/converter.py"
click node_analyzer "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/analyzer.py"
click node_enhancer "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docx_enhancer.py"
click node_smart "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/smart_converter.py"
click node_docling "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docling_converter.py"
click node_cloud "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cloud_converter.py"
click node_msword "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/msword_converter.py"
click node_libreoffice "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/libreoffice_converter.py"
click node_text "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/text_converter.py"
click node_ocr "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/ocr_converter.py"
click node_hybrid "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/hybrid_converter.py"
click node_combined "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/combined_converter.py"
click node_docx_pdf "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docx_to_pdf.py"
click node_key_config "https://github.com/christmardochee/pdf2word/blob/main/pdf2word/config.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_cli,node_api,node_cli_user toneBlue
class node_orchestrator,node_analyzer,node_enhancer,node_key_store toneAmber
class node_smart,node_docling,node_cloud,node_msword,node_libreoffice,node_text,node_ocr,node_hybrid,node_combined,node_cloud_service toneMint
class node_docx,node_docx_pdf,node_key_config,node_pdf_output toneRose
class node_python_user,node_input_pdf,node_ocr_service toneIndigo
```

## Components

### User entry points

- [CLI](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cli.py): `pdf2word/cli.py`
- [Python API](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/converter.py): `pdf2word/converter.py`

### Conversion routing

- [Conversion orchestrator](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/converter.py): `pdf2word/converter.py`
- [PDF analyzer](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/analyzer.py): `pdf2word/analyzer.py`
- [DOCX enhancer](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docx_enhancer.py): `pdf2word/docx_enhancer.py`

### Conversion engines

- [Smart conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/smart_converter.py): `pdf2word/smart_converter.py`
- [Docling conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docling_converter.py): `pdf2word/docling_converter.py`
- [Cloud conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/cloud_converter.py): `pdf2word/cloud_converter.py`
- [MS Word conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/msword_converter.py): `pdf2word/msword_converter.py`
- [LibreOffice conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/libreoffice_converter.py): `pdf2word/libreoffice_converter.py`
- [Text conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/text_converter.py): `pdf2word/text_converter.py`
- [OCR conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/ocr_converter.py): `pdf2word/ocr_converter.py`
- [Hybrid conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/hybrid_converter.py): `pdf2word/hybrid_converter.py`
- [Combined conversion](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/combined_converter.py): `pdf2word/combined_converter.py`

### Output and settings

- **Output DOCX**
- [DOCX to PDF](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/docx_to_pdf.py): `pdf2word/docx_to_pdf.py`
- [API key settings](https://github.com/christmardochee/pdf2word/blob/main/pdf2word/config.py): `pdf2word/config.py`
- **Output PDF**

### Other components

- **CLI user**
- **Python caller**
- **Input PDF**
- **ConvertAPI**
- **OCR engine**
- **Stored API key**

## Connections

- CLI user → CLI: runs commands
- Python caller → Python API: calls conversion
- CLI → Conversion orchestrator: starts conversion
- Python API → Conversion orchestrator: invokes conversion
- Conversion orchestrator → PDF analyzer: analyzes PDF
- Input PDF → PDF analyzer: reads PDF
- Conversion orchestrator → Smart conversion: routes conversion
- Conversion orchestrator → Docling conversion: routes conversion
- Conversion orchestrator → Cloud conversion: routes conversion
- Conversion orchestrator → MS Word conversion: routes conversion
- Conversion orchestrator → LibreOffice conversion: routes conversion
- Conversion orchestrator → Text conversion: routes conversion
- Conversion orchestrator → OCR conversion: routes conversion
- Conversion orchestrator → Hybrid conversion: routes conversion
- Conversion orchestrator → Combined conversion: routes conversion
- Conversion orchestrator → DOCX enhancer: post-processes DOCX
- Smart conversion → Output DOCX: produces DOCX
- Docling conversion → Output DOCX: produces DOCX
- Cloud conversion → ConvertAPI: uses conversion API
- Cloud conversion → Output DOCX: produces DOCX
- MS Word conversion → Output DOCX: produces DOCX
- LibreOffice conversion → Output DOCX: produces DOCX
- Text conversion → Output DOCX: produces DOCX
- OCR conversion → OCR engine: recognizes text
- OCR conversion → Output DOCX: produces DOCX
- Hybrid conversion → Output DOCX: produces DOCX
- Combined conversion → Output DOCX: produces DOCX
- CLI → DOCX to PDF: starts reconversion
- DOCX to PDF → Output PDF: produces PDF
- CLI → API key settings: manages key
- API key settings → Stored API key: stores key
