# pk-628996/random-tools-gui architecture

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

- Interactive diagram: https://gitdiagram.com/pk-628996/random-tools-gui
- Repository: https://github.com/pk-628996/random-tools-gui

## Overview

This is a small Tkinter desktop utility for PDF merging and adding chapter bookmarks. Users choose a feature from the main window, then select PDFs and provide ordering, page ranges, or chapter details. The merger maintains a selectable PDF list with page counts and ranges; the bookmark workflows collect chapter titles and page numbers and produce a bookmarked PDF. The repository also contains a separate chapter-bookmark GUI script. The excerpts establish the GUI structure and bookmark-file creation, but omit the merge and integrated bookmark command bodies, so those tool interactions are shown as unverified.

Main entry points: [`PdftkGui.py`](https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py) (Main window), [`add_chap.py`](https://github.com/pk-628996/random-tools-gui/blob/master/add_chap.py) (Chapter GUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["Desktop GUI"]
  node_main["Main window<br/>[PdftkGui.py]"]
end

subgraph group_pdf["PDF workflows"]
  node_merger["PDF merger<br/>[PdftkGui.py]"]
  node_bookmark_ui["Bookmark manager<br/>[PdftkGui.py]"]
  node_standalone["Chapter GUI<br/>[add_chap.py]"]
end

subgraph group_artifacts["PDF artifacts"]
  node_pdftk["Pdftk command"]
  node_merge_output["Merged PDF"]
  node_bookmark_data["Bookmark data"]
  node_bookmarked_pdf["Bookmarked PDF"]
end

node_user(("User"))

node_user -->|"uses"| node_main
node_main -->|"opens"| node_merger
node_main -->|"opens"| node_bookmark_ui
node_user -->|"uses"| node_standalone
node_merger -.->|"runs merge"| node_pdftk
node_pdftk -.->|"creates"| node_merge_output
node_bookmark_ui -->|"writes"| node_bookmark_data
node_bookmark_ui -.->|"updates PDF"| node_pdftk
node_pdftk -.->|"creates"| node_bookmarked_pdf
node_standalone -->|"writes"| node_bookmark_data
node_standalone -->|"runs update"| node_pdftk
node_pdftk -->|"creates"| node_bookmarked_pdf

click node_main "https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py"
click node_merger "https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py"
click node_bookmark_ui "https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py"
click node_standalone "https://github.com/pk-628996/random-tools-gui/blob/master/add_chap.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_main,node_user toneBlue
class node_merger,node_bookmark_ui,node_standalone toneAmber
class node_pdftk,node_merge_output,node_bookmark_data,node_bookmarked_pdf toneMint
```

## Components

### Desktop GUI

- [Main window](https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py): `PdftkGui.py`

### PDF workflows

- [PDF merger](https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py): `PdftkGui.py`
- [Bookmark manager](https://github.com/pk-628996/random-tools-gui/blob/master/PdftkGui.py): `PdftkGui.py`
- [Chapter GUI](https://github.com/pk-628996/random-tools-gui/blob/master/add_chap.py): `add_chap.py`

### PDF artifacts

- **Pdftk command**
- **Merged PDF**
- **Bookmark data**
- **Bookmarked PDF**

### Other components

- **User**

## Connections

- User → Main window: uses (evidence: `README.md`)
- Main window → PDF merger: opens (evidence: `PdftkGui.py`)
- Main window → Bookmark manager: opens (evidence: `PdftkGui.py`)
- User → Chapter GUI: uses (evidence: `add_chap.py`)
- PDF merger → Pdftk command: runs merge
- Pdftk command → Merged PDF: creates
- Bookmark manager → Bookmark data: writes (evidence: `PdftkGui.py`)
- Bookmark manager → Pdftk command: updates PDF
- Pdftk command → Bookmarked PDF: creates
- Chapter GUI → Bookmark data: writes (evidence: `add_chap.py`)
- Chapter GUI → Pdftk command: runs update (evidence: `add_chap.py`)
- Pdftk command → Bookmarked PDF: creates
