# jakubmelka/pdf4qt architecture

> Architecture diagram of the GitHub repository jakubmelka/pdf4qt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jakubmelka/pdf4qt
- Repository: https://github.com/jakubmelka/pdf4qt

## Overview

- Core PDF Libraries:
– Pdf4QtLibCore: Contains the core functionality for PDF parsing, rendering, encryption, text layout, annotations, and other document manipulations.
– Pdf4QtLibGui: Provides the windowed user interface components (dialogs, main windows, viewer windows, etc.).
– Pdf4QtLibWidgets: Offers specialized widgets and editors, including annotation tools, form handling, and other interactive elements.
- Standalone Applications (Executable Frontends):
– Pdf4QtViewer, Pdf4QtEditor, Pdf4QtDiff, Pdf4QtPageMaster, PdfTool, Pdf4QtLaunchPad, JBIG2_Viewer, PdfExampleGenerator.
Each of these executable projects leverages the underlying libraries to present a concrete application to end-users.
- Plugin System:
– Directory Pdf4QtEditorPlugins contains various plugins (such as AudioBookPlugin, DimensionsPlugin, ObjectInspectorPlugin, etc.) that extend the functionality of the PDF editor application.
- Ancillary Tools and Support:
– CodeGenerator: A tool/module to generate relevant code.
– Build and Dependency Management: CMake configuration files, vcpkg directories, and CI workflows are part of the infrastructure that supports the compilation and deployment.
- Third-party Dependencies:

##### Relationships and Data Flow
- That the CodeGenerator and JBIG2_Viewer operate as auxiliary tools that interface with the core libraries.

##### Architectural Patterns and Design Principles
- Modular and Layered Architecture: The separation of the PDF engine (core), the GUI/widgest layer, and the plugins/application layer should be visually apparent.
- Plugin Extensibility: Demonstrate how the plugin system is designed to extend the editor’s functionality, thereby showing dynamic extensibility points.
- Use of Modern C++ and Cross-Platform Build Infrastructure: Illustrate that the project leverages CMake, vcpkg, and workflows for CI/CD, emphasizing development lifecycle support.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies (Bottom Layer)
    subgraph "External Dependencies"
        EXT_LIB("External Libraries (Qt, OpenSSL, libjpeg, OpenJPEG, FreeType, LittleCMS, zlib)"):::external
    end

    %% Core PDF Libraries (Middle Layer)
    subgraph "Core PDF Libraries"
        LIB_CORE("Pdf4QtLibCore"):::core
        LIB_GUI("Pdf4QtLibGui"):::core
        LIB_WIDGETS("Pdf4QtLibWidgets"):::core
    end

    %% Standalone Applications (Upper Middle Layer)
    subgraph "Standalone Applications"
        APP_VIEWER("Pdf4QtViewer"):::app
        APP_EDITOR("Pdf4QtEditor"):::app
        APP_DIFF("Pdf4QtDiff"):::app
        APP_PAGEMASTER("Pdf4QtPageMaster"):::app
        APP_TOOL("PdfTool"):::app
        APP_LAUNCHPAD("Pdf4QtLaunchPad"):::app
        APP_JBIG2("JBIG2_Viewer"):::app
        APP_EXAMPLE("PdfExampleGenerator"):::app
    end

    %% Plugin System
    subgraph "Plugin System"
        PLUGINS("Pdf4QtEditorPlugins"):::plugin
    end

    %% Ancillary Tools
    subgraph "Ancillary Tools"
        CODEGEN("CodeGenerator"):::build
    end

    %% Build & Deployment Infrastructure
    subgraph "Build & Deployment"
        B_CMake("Build Config"):::build
        B_Workflows("CI Workflows"):::build
        B_vcpkg("vcpkg"):::build
    end

    %% Relationships: Standalone Applications depend on Core Libraries
    APP_VIEWER -->|"depends"| LIB_CORE
    APP_VIEWER -->|"depends"| LIB_GUI
    APP_VIEWER -->|"depends"| LIB_WIDGETS

    APP_EDITOR -->|"depends"| LIB_CORE
    APP_EDITOR -->|"depends"| LIB_GUI
    APP_EDITOR -->|"depends"| LIB_WIDGETS

    APP_DIFF -->|"depends"| LIB_CORE
    APP_DIFF -->|"depends"| LIB_GUI
    APP_DIFF -->|"depends"| LIB_WIDGETS

    APP_PAGEMASTER -->|"depends"| LIB_CORE
    APP_PAGEMASTER -->|"depends"| LIB_GUI
    APP_PAGEMASTER -->|"depends"| LIB_WIDGETS

    APP_TOOL -->|"depends"| LIB_CORE
    APP_TOOL -->|"depends"| LIB_GUI
    APP_TOOL -->|"depends"| LIB_WIDGETS

    APP_LAUNCHPAD -->|"depends"| LIB_CORE
    APP_LAUNCHPAD -->|"depends"| LIB_GUI
    APP_LAUNCHPAD -->|"depends"| LIB_WIDGETS

    APP_JBIG2 -->|"depends"| LIB_CORE
    APP_JBIG2 -->|"depends"| LIB_GUI
    APP_JBIG2 -->|"depends"| LIB_WIDGETS

    APP_EXAMPLE -->|"depends"| LIB_CORE
    APP_EXAMPLE -->|"depends"| LIB_GUI
    APP_EXAMPLE -->|"depends"| LIB_WIDGETS

    %% Plugin System extends the Pdf4QtEditor
    PLUGINS -->|"extends"| APP_EDITOR

    %% Ancillary Tools: CodeGenerator interfaces with Core Library
    CODEGEN -->|"interfaces"| LIB_CORE

    %% Build & Deployment support Core Libraries
    B_CMake -->|"builds"| LIB_CORE
    B_Workflows -->|"builds"| LIB_CORE
    B_vcpkg -->|"builds"| LIB_CORE

    %% Core Libraries interact with External Dependencies
    LIB_CORE -->|"uses"| EXT_LIB
    LIB_GUI -->|"uses"| EXT_LIB
    LIB_WIDGETS -->|"uses"| EXT_LIB

    %% Click Events
    click LIB_CORE "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtLibCore"
    click LIB_GUI "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtLibGui"
    click LIB_WIDGETS "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtLibWidgets"
    click APP_VIEWER "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtViewer"
    click APP_EDITOR "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtEditor"
    click APP_DIFF "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtDiff"
    click APP_PAGEMASTER "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtPageMaster"
    click APP_TOOL "https://github.com/jakubmelka/pdf4qt/tree/master/PdfTool"
    click APP_LAUNCHPAD "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtLaunchPad"
    click APP_JBIG2 "https://github.com/jakubmelka/pdf4qt/tree/master/JBIG2_Viewer"
    click APP_EXAMPLE "https://github.com/jakubmelka/pdf4qt/tree/master/PdfExampleGenerator"
    click PLUGINS "https://github.com/jakubmelka/pdf4qt/tree/master/Pdf4QtEditorPlugins"
    click CODEGEN "https://github.com/jakubmelka/pdf4qt/tree/master/CodeGenerator"
    click B_CMake "https://github.com/jakubmelka/pdf4qt/blob/master/CMakeLists.txt"
    click B_Workflows "https://github.com/jakubmelka/pdf4qt/tree/master/.github/workflows"
    click B_vcpkg "https://github.com/jakubmelka/pdf4qt/tree/master/vcpkg"

    %% Styles
    classDef core fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef app fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef plugin fill:#ffe0b2,stroke:#fb8c00,stroke-width:2px;
    classDef external fill:#e0e0e0,stroke:#9e9e9e,stroke-width:2px;
    classDef build fill:#d1c4e9,stroke:#673ab7,stroke-width:2px;
```
