# lore11-p/open-pdf architecture

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

- Interactive diagram: https://gitdiagram.com/lore11-p/open-pdf
- Repository: https://github.com/lore11-p/open-pdf

## Overview

Open PDF is a Windows desktop PDF reader/editor with local document processing, plus a stdio MCP server for AI clients. The main workflow is opening a local PDF, viewing and editing it, then saving or exporting results; separate branches cover conversion, collaboration, security, and signatures. Edges use the README and source-index references, with direct calls included only where excerpts show them; unsampled command wiring is not inferred.

Main entry points: [`src/main.rs`](https://github.com/lore11-p/open-pdf/blob/main/src/main.rs) (Tauri commands), [`src/engine.rs`](https://github.com/lore11-p/open-pdf/blob/main/src/engine.rs) (PDFium engine), [`src/pades.rs`](https://github.com/lore11-p/open-pdf/blob/main/src/pades.rs) (PAdES signing), [`ui`](https://github.com/lore11-p/open-pdf/tree/main/ui) (Desktop UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop workflow"]
  node_desktop_ui["Desktop UI"]
  node_tauri["Tauri commands<br/>[main.rs]"]
  node_session["Session state<br/>[state.rs]"]
  node_pdf_engine["PDFium engine<br/>[engine.rs]"]
  node_updater["Release updates<br/>[update.rs]"]
end

subgraph group_document["Document operations"]
  node_annotation["Annotations<br/>[annotate.rs]"]
  node_text_edit["Text editing<br/>[pdftext.rs]"]
  node_redaction["Irreversible redaction<br/>[redact.rs]"]
  node_sanitization["Deep cleanup<br/>[sanitize.rs]"]
  node_pages["Page operations<br/>[pages.rs]"]
  node_conversion["Conversion and export<br/>[convert.rs]"]
  node_image_loader["Image loading<br/>[image_loader.rs]"]
  node_ocr["OCR and speech<br/>[ocr.rs]"]
  node_forms_security["Forms and passwords<br/>[security.rs]"]
end

subgraph group_signing["Signatures and trust"]
  node_signature_marks["PAdES signing<br/>[pades.rs]"]
  node_tsa["Timestamping<br/>[pades_tsa.rs]"]
  node_signature_verify["Signature verification<br/>[pades_verify.rs]"]
  node_ocsp["OCSP revocation<br/>[pades_ocsp.rs]"]
end

subgraph group_sharing["Sharing and security"]
  node_share["Local collaboration<br/>[collab.rs]"]
  node_signature_capture["Signature capture<br/>[signature.rs]"]
end

subgraph group_agents["AI integration"]
  node_mcp_server["MCP server<br/>[mcp_server.rs]"]
end

node_user(("Local user"))
node_mcp_client(("AI agent client"))

node_user -->|"uses"| node_desktop_ui
node_desktop_ui -->|"invokes commands"| node_tauri
node_tauri -->|"manages"| node_session
node_tauri -->|"renders and reads"| node_pdf_engine
node_tauri -->|"dispatches"| node_annotation
node_tauri -->|"dispatches"| node_text_edit
node_tauri -->|"dispatches"| node_redaction
node_tauri -->|"dispatches"| node_sanitization
node_tauri -->|"dispatches"| node_pages
node_tauri -->|"dispatches"| node_conversion
node_tauri -->|"dispatches"| node_image_loader
node_tauri -->|"dispatches"| node_ocr
node_tauri -->|"dispatches"| node_forms_security
node_tauri -->|"dispatches"| node_signature_marks
node_tauri -->|"dispatches"| node_signature_verify
node_tauri -->|"dispatches"| node_ocsp
node_tauri -->|"dispatches"| node_share
node_tauri -->|"dispatches"| node_signature_capture
node_tauri -->|"checks releases"| node_updater
node_conversion -->|"uses"| node_pdf_engine
node_pages -->|"uses"| node_pdf_engine
node_ocr -->|"uses"| node_pdf_engine
node_annotation -->|"uses"| node_pdf_engine
node_share -->|"renders pages"| node_pdf_engine
node_signature_marks -->|"requests timestamps"| node_tsa
node_signature_marks -->|"uses verification"| node_signature_verify
node_signature_marks -->|"checks revocation"| node_ocsp
node_mcp_client -->|"sends MCP requests"| node_mcp_server
node_mcp_server -.->|"uses PDFium"| node_pdf_engine

click node_desktop_ui "https://github.com/lore11-p/open-pdf/tree/main/ui"
click node_tauri "https://github.com/lore11-p/open-pdf/blob/main/src/main.rs"
click node_session "https://github.com/lore11-p/open-pdf/blob/main/src/state.rs"
click node_pdf_engine "https://github.com/lore11-p/open-pdf/blob/main/src/engine.rs"
click node_annotation "https://github.com/lore11-p/open-pdf/blob/main/src/annotate.rs"
click node_text_edit "https://github.com/lore11-p/open-pdf/blob/main/src/pdftext.rs"
click node_redaction "https://github.com/lore11-p/open-pdf/blob/main/src/redact.rs"
click node_sanitization "https://github.com/lore11-p/open-pdf/blob/main/src/sanitize.rs"
click node_pages "https://github.com/lore11-p/open-pdf/blob/main/src/pages.rs"
click node_conversion "https://github.com/lore11-p/open-pdf/blob/main/src/convert.rs"
click node_image_loader "https://github.com/lore11-p/open-pdf/blob/main/src/image_loader.rs"
click node_ocr "https://github.com/lore11-p/open-pdf/blob/main/src/ocr.rs"
click node_forms_security "https://github.com/lore11-p/open-pdf/blob/main/src/security.rs"
click node_signature_marks "https://github.com/lore11-p/open-pdf/blob/main/src/pades.rs"
click node_tsa "https://github.com/lore11-p/open-pdf/blob/main/src/pades_tsa.rs"
click node_signature_verify "https://github.com/lore11-p/open-pdf/blob/main/src/pades_verify.rs"
click node_ocsp "https://github.com/lore11-p/open-pdf/blob/main/src/pades_ocsp.rs"
click node_share "https://github.com/lore11-p/open-pdf/blob/main/src/collab.rs"
click node_signature_capture "https://github.com/lore11-p/open-pdf/blob/main/src/signature.rs"
click node_updater "https://github.com/lore11-p/open-pdf/blob/main/src/update.rs"
click node_mcp_server "https://github.com/lore11-p/open-pdf/blob/main/src/mcp_server.rs"

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_desktop_ui,node_tauri,node_session,node_pdf_engine,node_updater,node_user,node_mcp_client toneBlue
class node_annotation,node_text_edit,node_redaction,node_sanitization,node_pages,node_conversion,node_image_loader,node_ocr,node_forms_security toneAmber
class node_signature_marks,node_tsa,node_signature_verify,node_ocsp toneMint
class node_share,node_signature_capture toneRose
class node_mcp_server toneIndigo
```

## Components

### Desktop workflow

- [Desktop UI](https://github.com/lore11-p/open-pdf/tree/main/ui): `ui`
- [Tauri commands](https://github.com/lore11-p/open-pdf/blob/main/src/main.rs): `src/main.rs`
- [Session state](https://github.com/lore11-p/open-pdf/blob/main/src/state.rs): `src/state.rs`
- [PDFium engine](https://github.com/lore11-p/open-pdf/blob/main/src/engine.rs): `src/engine.rs`
- [Release updates](https://github.com/lore11-p/open-pdf/blob/main/src/update.rs): `src/update.rs`

### Document operations

- [Annotations](https://github.com/lore11-p/open-pdf/blob/main/src/annotate.rs): `src/annotate.rs`
- [Text editing](https://github.com/lore11-p/open-pdf/blob/main/src/pdftext.rs): `src/pdftext.rs`
- [Irreversible redaction](https://github.com/lore11-p/open-pdf/blob/main/src/redact.rs): `src/redact.rs`
- [Deep cleanup](https://github.com/lore11-p/open-pdf/blob/main/src/sanitize.rs): `src/sanitize.rs`
- [Page operations](https://github.com/lore11-p/open-pdf/blob/main/src/pages.rs): `src/pages.rs`
- [Conversion and export](https://github.com/lore11-p/open-pdf/blob/main/src/convert.rs): `src/convert.rs`
- [Image loading](https://github.com/lore11-p/open-pdf/blob/main/src/image_loader.rs): `src/image_loader.rs`
- [OCR and speech](https://github.com/lore11-p/open-pdf/blob/main/src/ocr.rs): `src/ocr.rs`
- [Forms and passwords](https://github.com/lore11-p/open-pdf/blob/main/src/security.rs): `src/security.rs`

### Signatures and trust

- [PAdES signing](https://github.com/lore11-p/open-pdf/blob/main/src/pades.rs): `src/pades.rs`
- [Timestamping](https://github.com/lore11-p/open-pdf/blob/main/src/pades_tsa.rs): `src/pades_tsa.rs`
- [Signature verification](https://github.com/lore11-p/open-pdf/blob/main/src/pades_verify.rs): `src/pades_verify.rs`
- [OCSP revocation](https://github.com/lore11-p/open-pdf/blob/main/src/pades_ocsp.rs): `src/pades_ocsp.rs`

### Sharing and security

- [Local collaboration](https://github.com/lore11-p/open-pdf/blob/main/src/collab.rs): `src/collab.rs`
- [Signature capture](https://github.com/lore11-p/open-pdf/blob/main/src/signature.rs): `src/signature.rs`

### AI integration

- [MCP server](https://github.com/lore11-p/open-pdf/blob/main/src/mcp_server.rs): `src/mcp_server.rs`

### Other components

- **Local user**
- **AI agent client**

## Connections

- Local user → Desktop UI: uses (evidence: `README.md`)
- Desktop UI → Tauri commands: invokes commands (evidence: `README.md`)
- Tauri commands → Session state: manages (evidence: `README.md`)
- Tauri commands → PDFium engine: renders and reads (evidence: `src/main.rs`)
- Tauri commands → Annotations: dispatches (evidence: `src/main.rs`)
- Tauri commands → Text editing: dispatches (evidence: `src/main.rs`)
- Tauri commands → Irreversible redaction: dispatches (evidence: `src/main.rs`)
- Tauri commands → Deep cleanup: dispatches (evidence: `src/main.rs`)
- Tauri commands → Page operations: dispatches (evidence: `src/main.rs`)
- Tauri commands → Conversion and export: dispatches (evidence: `src/main.rs`)
- Tauri commands → Image loading: dispatches (evidence: `src/main.rs`)
- Tauri commands → OCR and speech: dispatches (evidence: `src/main.rs`)
- Tauri commands → Forms and passwords: dispatches (evidence: `src/main.rs`)
- Tauri commands → PAdES signing: dispatches (evidence: `src/main.rs`)
- Tauri commands → Signature verification: dispatches (evidence: `src/main.rs`)
- Tauri commands → OCSP revocation: dispatches (evidence: `src/main.rs`)
- Tauri commands → Local collaboration: dispatches (evidence: `src/main.rs`)
- Tauri commands → Signature capture: dispatches (evidence: `src/main.rs`)
- Tauri commands → Release updates: checks releases (evidence: `README.md`)
- Conversion and export → PDFium engine: uses (evidence: `src/convert.rs`)
- Page operations → PDFium engine: uses (evidence: `src/pages.rs`)
- OCR and speech → PDFium engine: uses (evidence: `src/ocr.rs`)
- Annotations → PDFium engine: uses (evidence: `src/annotate.rs`)
- Local collaboration → PDFium engine: renders pages (evidence: `src/collab.rs`)
- PAdES signing → Timestamping: requests timestamps (evidence: `src/pades.rs`)
- PAdES signing → Signature verification: uses verification (evidence: `src/pades.rs`)
- PAdES signing → OCSP revocation: checks revocation (evidence: `src/pades.rs`)
- AI agent client → MCP server: sends MCP requests (evidence: `README.md`)
- MCP server → PDFium engine: uses PDFium
