# danialjaved/rune architecture

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

- Interactive diagram: https://gitdiagram.com/danialjaved/rune
- Repository: https://github.com/danialjaved/rune

## Overview

Rune is a native Windows PDF reader whose main workflow is opening a local PDF, displaying and navigating it, and applying reading or editing operations before saving, printing, or sharing. The graph covers the UI, document/rendering engine, PDFium bridge, and Windows integrations. README capabilities fill in several unsampled feature branches; edges are limited to relationships visible in excerpts or documented in the README.

Main entry points: [`src/Rune.App/MainWindow.xaml.cs`](https://github.com/danialjaved/rune/blob/main/src/Rune.App/MainWindow.xaml.cs) (App window), [`src/Rune.App/Controls/PdfViewer.xaml.cs`](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.xaml.cs) (PDF viewer), [`src/Rune.Engine/PdfDocument.cs`](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.cs) (Open PDF document), [`src/Rune.App/Controls/PdfViewer.StampPlacement.cs`](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.StampPlacement.cs) (Signature placement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Reader interface"]
  node_window["App window<br/>[MainWindow.xaml.cs]"]
  node_docview["Document tabs"]
  node_viewer["PDF viewer<br/>[PdfViewer.xaml.cs]"]
  node_presentation["Presentation mode"]
  node_palette["Command palette"]
  node_markup_ui["Markup tools<br/>[AnnotationTool.cs]"]
  node_text_ui["Text editing UI"]
  node_stamp_ui["Signature placement"]
  node_forms_ui["Form interaction<br/>[PdfViewer.Forms.cs]"]
end

subgraph group_engine["Document engine"]
  node_document["Open PDF document<br/>[PdfDocument.cs]"]
  node_render["Tile rendering<br/>[RenderScheduler.cs]"]
  node_bitmap["Page bitmap<br/>[PageBitmap.cs]"]
  node_textdata["Page text<br/>[PageText.cs]"]
  node_search["Document search<br/>[DocumentSearch.cs]"]
  node_annotations["PDF annotations"]
  node_textops["PDF text operations"]
  node_forms["PDF forms"]
  node_fieldappearance["Field appearance<br/>[FieldAppearance.cs]"]
  node_flatten["Flatten edits"]
  node_signatures["Signature data"]
  node_matte["Signature matting<br/>[SignatureMatte.cs]"]
end

subgraph group_pdfium["PDFium interop"]
  node_pdfiumfacade["PDFium facade<br/>[PdfiumNative.cs]"]
  node_native["Native bindings<br/>[NativeMethods.cs]"]
  node_fileaccess["Lazy file access"]
end

subgraph group_windows["Windows services"]
  node_filepicker["File picker<br/>[FilePickerHost.cs]"]
  node_print["Print service<br/>[PrintService.cs]"]
  node_share["Share service<br/>[ShareService.cs]"]
  node_signature_store[("Saved signatures<br/>[SignatureStore.cs]")]
end

node_reader(("Reader user"))
node_windows_share["Windows share sheet"]
node_windows_print["Windows printing"]
node_local_files[("Local PDF files")]

node_reader -->|"uses"| node_window
node_window -->|"hosts tabs"| node_docview
node_docview -->|"displays document"| node_viewer
node_viewer -->|"requests tiles"| node_render
node_render -->|"renders pages"| node_document
node_document -->|"calls"| node_pdfiumfacade
node_pdfiumfacade -->|"wraps bindings"| node_native
node_document -->|"opens lazily"| node_fileaccess
node_window -->|"opens and saves"| node_filepicker
node_filepicker -->|"selects files"| node_local_files
node_viewer -->|"selects text"| node_textdata
node_window -->|"searches pages"| node_search
node_search -->|"queries text"| node_document
node_viewer -->|"edits markup"| node_annotations
node_window -->|"offers tools"| node_markup_ui
node_viewer -->|"edits page text"| node_text_ui
node_text_ui -->|"writes text"| node_textops
node_viewer -->|"edits fields"| node_forms_ui
node_forms_ui -->|"updates fields"| node_forms
node_forms -->|"uses appearance"| node_fieldappearance
node_viewer -->|"places signature"| node_stamp_ui
node_stamp_ui -->|"reuses signatures"| node_signature_store
node_stamp_ui -->|"removes paper"| node_matte
node_window -->|"flattens edits"| node_flatten
node_window -->|"prints document"| node_print
node_print -->|"renders print pages"| node_document
node_print -->|"opens print UI"| node_windows_print
node_window -->|"shares document"| node_share
node_share -->|"saves share copy"| node_document
node_share -->|"opens share sheet"| node_windows_share
node_document -->|"reads signature details"| node_signatures
node_viewer -->|"shows fullscreen"| node_presentation
node_window -->|"opens commands"| node_palette
node_render -->|"produces pixels"| node_bitmap

click node_window "https://github.com/danialjaved/rune/blob/main/src/Rune.App/MainWindow.xaml.cs"
click node_docview "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/DocumentView.xaml.cs"
click node_viewer "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.xaml.cs"
click node_presentation "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PresentationView.xaml.cs"
click node_palette "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/CommandPalette.xaml.cs"
click node_markup_ui "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/AnnotationTool.cs"
click node_text_ui "https://github.com/danialjaved/rune/blob/main/src/Rune.App/MainWindow.TextTool.cs"
click node_stamp_ui "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.StampPlacement.cs"
click node_forms_ui "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.Forms.cs"
click node_document "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.cs"
click node_render "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/RenderScheduler.cs"
click node_bitmap "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PageBitmap.cs"
click node_textdata "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PageText.cs"
click node_search "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/DocumentSearch.cs"
click node_annotations "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Annotations.cs"
click node_textops "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Text.cs"
click node_forms "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Forms.cs"
click node_fieldappearance "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/FieldAppearance.cs"
click node_flatten "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Flatten.cs"
click node_signatures "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Signatures.cs"
click node_matte "https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/SignatureMatte.cs"
click node_pdfiumfacade "https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/PdfiumNative.cs"
click node_native "https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/NativeMethods.cs"
click node_fileaccess "https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/FileAccessAdapter.cs"
click node_filepicker "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/FilePickerHost.cs"
click node_print "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/PrintService.cs"
click node_share "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/ShareService.cs"
click node_signature_store "https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/SignatureStore.cs"

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_window,node_docview,node_viewer,node_presentation,node_palette,node_markup_ui,node_text_ui,node_stamp_ui,node_forms_ui,node_reader toneBlue
class node_document,node_render,node_bitmap,node_textdata,node_search,node_annotations,node_textops,node_forms,node_fieldappearance,node_flatten,node_signatures,node_matte,node_local_files toneAmber
class node_pdfiumfacade,node_native,node_fileaccess toneMint
class node_filepicker,node_print,node_share,node_signature_store toneRose
class node_windows_share,node_windows_print toneIndigo
```

## Components

### Reader interface

- [App window](https://github.com/danialjaved/rune/blob/main/src/Rune.App/MainWindow.xaml.cs): `src/Rune.App/MainWindow.xaml.cs`
- [Document tabs](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/DocumentView.xaml.cs): `src/Rune.App/Controls/DocumentView.xaml.cs`
- [PDF viewer](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.xaml.cs): `src/Rune.App/Controls/PdfViewer.xaml.cs`
- [Presentation mode](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PresentationView.xaml.cs): `src/Rune.App/Controls/PresentationView.xaml.cs`
- [Command palette](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/CommandPalette.xaml.cs): `src/Rune.App/Controls/CommandPalette.xaml.cs`
- [Markup tools](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/AnnotationTool.cs): `src/Rune.App/Controls/AnnotationTool.cs`
- [Text editing UI](https://github.com/danialjaved/rune/blob/main/src/Rune.App/MainWindow.TextTool.cs): `src/Rune.App/MainWindow.TextTool.cs`
- [Signature placement](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.StampPlacement.cs): `src/Rune.App/Controls/PdfViewer.StampPlacement.cs`
- [Form interaction](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Controls/PdfViewer.Forms.cs): `src/Rune.App/Controls/PdfViewer.Forms.cs`

### Document engine

- [Open PDF document](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.cs): `src/Rune.Engine/PdfDocument.cs`
- [Tile rendering](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/RenderScheduler.cs): `src/Rune.Engine/RenderScheduler.cs`
- [Page bitmap](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PageBitmap.cs): `src/Rune.Engine/PageBitmap.cs`
- [Page text](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PageText.cs): `src/Rune.Engine/PageText.cs`
- [Document search](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/DocumentSearch.cs): `src/Rune.Engine/DocumentSearch.cs`
- [PDF annotations](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Annotations.cs): `src/Rune.Engine/PdfDocument.Annotations.cs`
- [PDF text operations](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Text.cs): `src/Rune.Engine/PdfDocument.Text.cs`
- [PDF forms](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Forms.cs): `src/Rune.Engine/PdfDocument.Forms.cs`
- [Field appearance](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/FieldAppearance.cs): `src/Rune.Engine/FieldAppearance.cs`
- [Flatten edits](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Flatten.cs): `src/Rune.Engine/PdfDocument.Flatten.cs`
- [Signature data](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/PdfDocument.Signatures.cs): `src/Rune.Engine/PdfDocument.Signatures.cs`
- [Signature matting](https://github.com/danialjaved/rune/blob/main/src/Rune.Engine/SignatureMatte.cs): `src/Rune.Engine/SignatureMatte.cs`

### PDFium interop

- [PDFium facade](https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/PdfiumNative.cs): `src/Rune.PdfiumInterop/PdfiumNative.cs`
- [Native bindings](https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/NativeMethods.cs): `src/Rune.PdfiumInterop/NativeMethods.cs`
- [Lazy file access](https://github.com/danialjaved/rune/blob/main/src/Rune.PdfiumInterop/FileAccessAdapter.cs): `src/Rune.PdfiumInterop/FileAccessAdapter.cs`

### Windows services

- [File picker](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/FilePickerHost.cs): `src/Rune.App/Services/FilePickerHost.cs`
- [Print service](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/PrintService.cs): `src/Rune.App/Services/PrintService.cs`
- [Share service](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/ShareService.cs): `src/Rune.App/Services/ShareService.cs`
- [Saved signatures](https://github.com/danialjaved/rune/blob/main/src/Rune.App/Services/SignatureStore.cs): `src/Rune.App/Services/SignatureStore.cs`

### Other components

- **Reader user**
- **Windows share sheet**
- **Windows printing**
- **Local PDF files**

## Connections

- Reader user → App window: uses (evidence: `README.md`)
- App window → Document tabs: hosts tabs (evidence: `src/Rune.App/MainWindow.xaml.cs`)
- Document tabs → PDF viewer: displays document (evidence: `src/Rune.App/Controls/DocumentView.xaml.cs`)
- PDF viewer → Tile rendering: requests tiles (evidence: `src/Rune.App/Controls/PdfViewer.xaml.cs`)
- Tile rendering → Open PDF document: renders pages (evidence: `src/Rune.Engine/RenderScheduler.cs`)
- Open PDF document → PDFium facade: calls (evidence: `src/Rune.Engine/PdfDocument.cs`)
- PDFium facade → Native bindings: wraps bindings (evidence: `src/Rune.PdfiumInterop/PdfiumNative.cs`)
- Open PDF document → Lazy file access: opens lazily (evidence: `src/Rune.Engine/PdfDocument.cs`)
- App window → File picker: opens and saves (evidence: `src/Rune.App/MainWindow.xaml.cs`)
- File picker → Local PDF files: selects files (evidence: `src/Rune.App/Services/FilePickerHost.cs`)
- PDF viewer → Page text: selects text (evidence: `src/Rune.App/Controls/PdfViewer.xaml.cs`)
- App window → Document search: searches pages (evidence: `src/Rune.App/MainWindow.xaml.cs`)
- Document search → Open PDF document: queries text (evidence: `src/Rune.Engine/DocumentSearch.cs`)
- PDF viewer → PDF annotations: edits markup (evidence: `README.md`)
- App window → Markup tools: offers tools (evidence: `README.md`)
- PDF viewer → Text editing UI: edits page text (evidence: `README.md`)
- Text editing UI → PDF text operations: writes text (evidence: `README.md`)
- PDF viewer → Form interaction: edits fields (evidence: `README.md`)
- Form interaction → PDF forms: updates fields (evidence: `README.md`)
- PDF forms → Field appearance: uses appearance (evidence: `src/Rune.Engine/PdfDocument.Forms.cs`)
- PDF viewer → Signature placement: places signature (evidence: `README.md`)
- Signature placement → Saved signatures: reuses signatures
- Signature placement → Signature matting: removes paper
- App window → Flatten edits: flattens edits (evidence: `README.md`)
- App window → Print service: prints document (evidence: `README.md`)
- Print service → Open PDF document: renders print pages (evidence: `src/Rune.App/Services/PrintService.cs`)
- Print service → Windows printing: opens print UI (evidence: `src/Rune.App/Services/PrintService.cs`)
- App window → Share service: shares document (evidence: `src/Rune.App/MainWindow.xaml.cs`)
- Share service → Open PDF document: saves share copy (evidence: `src/Rune.App/Services/ShareService.cs`)
- Share service → Windows share sheet: opens share sheet (evidence: `README.md`)
- Open PDF document → Signature data: reads signature details (evidence: `README.md`)
- PDF viewer → Presentation mode: shows fullscreen (evidence: `README.md`)
- App window → Command palette: opens commands (evidence: `README.md`)
- Tile rendering → Page bitmap: produces pixels (evidence: `src/Rune.Engine/RenderScheduler.cs`)
