Skip to content

Commit

Permalink
Custom UI (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frooodle authored Feb 3, 2025
1 parent 8b8a4fb commit d34c54d
Showing 1 changed file with 92 additions and 9 deletions.
101 changes: 92 additions & 9 deletions docs/Advanced Configuration/UI Customisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,122 @@ import TabItem from '@theme/TabItem';

# UI Customisation

Stirling PDF allows straightforward customization of the application name to make Stirling-PDF your own
These are
- ``appName`` This defines the visible application name showed in the window name and navbar if navbar is not defined separately
- ``homeDescription`` The description to be displayed on the homepage under the navbar that first greets the user
- ``appNameNavbar`` The app name to be shown within to navbar for all pages
Stirling PDF allows straightforward customization of the application name and appearance to make Stirling-PDF your own.

## Application Name Settings
These settings control the visible application name:
- `appName` - Defines the visible application name shown in the window name and navbar if navbar is not defined separately
- `homeDescription` - The description displayed on the homepage under the navbar that first greets the user
- `appNameNavbar` - The app name shown within the navbar for all pages

## Configurations Examples
## Show update notifications
These settings (in Settings.yml) control system behavior and customization capabilities:
- `showUpdate` - Controls whether update notifications are displayed
- `showUpdateOnlyAdmin` - When true, restricts update notifications to admin users only (requires `showUpdate: true`)


## System Configuration
``customHTMLFiles`` In Settings.yml Enables custom HTML file overrides (called fragments) when set to true

## Custom Files
When `customHTMLFiles` is enabled, you can override the default templatesby placing your custom files in specific directories. The system uses a resource override mechanism where files in these custom directories take precedence over the default files.

### Directory Structure
```
customFiles/
├── static/ # Static assets (CSS, JS, images, etc.)
└── templates/ # HTML template files
```

### File Locations
The root path for custom files varies by installation type:
- **Default/Docker Installation**: `./customFiles/`
- **Windows Desktop**: `%APPDATA%\Stirling-PDF\customFiles\`
- **MacOS Desktop**: `~/Library/Application Support/Stirling-PDF/customFiles/`
- **Linux Desktop**: `~/.config/Stirling-PDF/customFiles/`

### Override Examples
To override existing files, maintain the same directory structure as the original. Here are some examples with links to the original files you would be overriding:

To override a file:
1. Navigate to the original file in the GitHub repository
2. Copy its contents
3. Create the same file path under your `customFiles` directory following the same directory structure
4. Paste and modify the contents as needed

Note: When overriding templates, first copy the existing template from the [source repository](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/templates) to maintain the base structure.

1. To replace the favicon:
```
customFiles/static/favicon.svg
```
Original file: [src/main/resources/static/favicon.svg](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/static/favicon.svg)

2. To override a Bootstrap icon font:
```
customFiles/static/css/fonts/bootstrap-icons.woff
```
Original file: [src/main/resources/static/css/fonts/bootstrap-icons.woff](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/static/css/fonts/bootstrap-icons.woff)

3. To modify a template:
```
customFiles/templates/fragments/common.html
```
Original file: [src/main/resources/templates/fragments/common.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/common.html)

The original files can be found in the GitHub repository under:
- Static files: [src/main/resources/static/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/static)
- Templates (HTML files): [src/main/resources/templates/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/templates)




## Configuration Examples

<Tabs groupId="config-methods">
<TabItem value="settings" label="Settings File">
```yaml
ui:
appName: exampleAppName # Application's visible name
homeDescription: I am a description # Short description or tagline shown on homepage.
homeDescription: I am a description # Short description or tagline shown on homepage
appNameNavbar: navbarName # Name displayed on the navigation bar

system:
showUpdate: false # Control update notification visibility
showUpdateOnlyAdmin: false # Restrict update notifications to admins
customHTMLFiles: false # Enable custom HTML/CSS overrides
```
</TabItem>
<TabItem value="local" label="Local Environment">
You can configure the UI elements in two ways when running locally:
You can configure the UI and system settings in two ways when running locally:

**Option 1: Using Java Properties**
```bash
java -jar Stirling-PDF.jar -DAPP_HOME_NAME="New Application Name"
java -jar Stirling-PDF.jar \
-DAPP_HOME_NAME="New Application Name" \
-DSHOW_UPDATE=false \
-DSHOW_UPDATE_ONLY_ADMIN=false \
-DCUSTOM_HTML_FILES=true
```

**Option 2: Using Environment Variables**
```bash
export UI_APP_NAME="Stirling PDF"
export UI_HOME_DESCRIPTION="Your locally hosted one-stop-shop for all your PDF needs."
export UI_APP_NAVBAR_NAME="Stirling PDF"
export SYSTEM_SHOW_UPDATE=false
export SYSTEM_SHOW_UPDATE_ONLY_ADMIN=false
export SYSTEM_CUSTOM_HTML_FILES=true
```
</TabItem>
<TabItem value="docker-run" label="Docker Run">
```bash
-e UI_APP_NAME=Stirling PDF \
-e UI_HOME_DESCRIPTION=Your locally hosted one-stop-shop for all your PDF needs. \
-e UI_APP_NAVBAR_NAME=Stirling PDF \
-e SYSTEM_SHOW_UPDATE=false \
-e SYSTEM_SHOW_UPDATE_ONLY_ADMIN=false \
-e SYSTEM_CUSTOM_HTML_FILES=true
```
</TabItem>
<TabItem value="docker-compose" label="Docker Compose">
Expand All @@ -52,6 +130,11 @@ These are
UI_APP_NAME: Stirling PDF
UI_HOME_DESCRIPTION: Your locally hosted one-stop-shop for all your PDF needs.
UI_APP_NAVBAR_NAME: Stirling PDF
SYSTEM_SHOW_UPDATE: "false"
SYSTEM_SHOW_UPDATE_ONLY_ADMIN: "false"
SYSTEM_CUSTOM_HTML_FILES: "true"
volumes:
- ./customFiles:/app/customFiles # Mount custom files directory
```
</TabItem>
</Tabs>

0 comments on commit d34c54d

Please sign in to comment.