fixed minor bugs in Markdown (#2152)

This commit is contained in:
Ludy 2024-11-03 08:20:10 +01:00 committed by GitHub
parent 2be14788b1
commit a5aac01b4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 447 additions and 427 deletions

View File

@ -1,6 +1,7 @@
# New Database Backup and Import Functionality # New Database Backup and Import Functionality
**Full activation will take place on approximately January 5th, 2025!** > [!IMPORTANT]
> **Full activation will take place on approximately January 5th, 2025!**
Why is the waiting time six months? Why is the waiting time six months?

View File

@ -7,6 +7,7 @@ Stirling-PDF is a robust, locally hosted web-based PDF manipulation tool. This g
## 2. Project Overview ## 2. Project Overview
Stirling-PDF is built using: Stirling-PDF is built using:
- Spring Boot + Thymeleaf - Spring Boot + Thymeleaf
- PDFBox - PDFBox
- LibreOffice - LibreOffice
@ -20,14 +21,17 @@ Stirling-PDF is built using:
## 3. Development Environment Setup ## 3. Development Environment Setup
### Prerequisites ### Prerequisites
- Docker - Docker
- Git - Git
- Java JDK 17 or later - Java JDK 17 or later
- Gradle 7.0 or later (Included within repo) - Gradle 7.0 or later (Included within repo)
### Setup Steps ### Setup Steps
1. Clone the repository: 1. Clone the repository:
```
```bash
git clone https://github.com/Stirling-Tools/Stirling-PDF.git git clone https://github.com/Stirling-Tools/Stirling-PDF.git
cd Stirling-PDF cd Stirling-PDF
``` ```
@ -43,10 +47,9 @@ Visit the [Lombok website](https://projectlombok.org/setup/) for installation in
5. Add environment variable 5. Add environment variable
For local testing you should generally be testing the full 'Security' version of Stirling-PDF to do this you must add the environment flag DOCKER_ENABLE_SECURITY=true to your system and/or IDE build/run step For local testing you should generally be testing the full 'Security' version of Stirling-PDF to do this you must add the environment flag DOCKER_ENABLE_SECURITY=true to your system and/or IDE build/run step
## 4. Project Structure ## 4. Project Structure
``` ```bash
Stirling-PDF/ Stirling-PDF/
├── .github/ # GitHub-specific files (workflows, issue templates) ├── .github/ # GitHub-specific files (workflows, issue templates)
├── configs/ # Configuration files used by stirling at runtime (generated at runtime) ├── configs/ # Configuration files used by stirling at runtime (generated at runtime)
@ -92,6 +95,7 @@ Stirling-PDF/
## 5. Docker-based Development ## 5. Docker-based Development
Stirling-PDF offers several Docker versions: Stirling-PDF offers several Docker versions:
- Full: All features included - Full: All features included
- Ultra-Lite: Basic PDF operations only - Ultra-Lite: Basic PDF operations only
- Fat: Includes additional libraries and fonts predownloaded - Fat: Includes additional libraries and fonts predownloaded
@ -153,11 +157,13 @@ docker-compose -f exampleYmlFiles/docker-compose-latest-security.yml up
Stirling-PDF uses different Docker images for various configurations. The build process is controlled by environment variables and uses specific Dockerfile variants. Here's how to build the Docker images: Stirling-PDF uses different Docker images for various configurations. The build process is controlled by environment variables and uses specific Dockerfile variants. Here's how to build the Docker images:
1. Set the security environment variable: 1. Set the security environment variable:
```bash ```bash
export DOCKER_ENABLE_SECURITY=false # or true for security-enabled builds export DOCKER_ENABLE_SECURITY=false # or true for security-enabled builds
``` ```
2. Build the project with Gradle: 2. Build the project with Gradle:
```bash ```bash
./gradlew clean build ./gradlew clean build
``` ```
@ -165,16 +171,19 @@ Stirling-PDF uses different Docker images for various configurations. The build
3. Build the Docker images: 3. Build the Docker images:
For the latest version: For the latest version:
```bash ```bash
docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile . docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile .
``` ```
For the ultra-lite version: For the ultra-lite version:
```bash ```bash
docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-ultra-lite -f ./Dockerfile-ultra-lite . docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-ultra-lite -f ./Dockerfile-ultra-lite .
``` ```
For the fat version (with security enabled): For the fat version (with security enabled):
```bash ```bash
export DOCKER_ENABLE_SECURITY=true export DOCKER_ENABLE_SECURITY=true
docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-fat -f ./Dockerfile-fat . docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-fat -f ./Dockerfile-fat .
@ -182,8 +191,6 @@ Stirling-PDF uses different Docker images for various configurations. The build
Note: The `--no-cache` and `--pull` flags ensure that the build process uses the latest base images and doesn't use cached layers, which is useful for testing and ensuring reproducible builds. however to improve build times these can often be removed depending on your usecase Note: The `--no-cache` and `--pull` flags ensure that the build process uses the latest base images and doesn't use cached layers, which is useful for testing and ensuring reproducible builds. however to improve build times these can often be removed depending on your usecase
## 6. Testing ## 6. Testing
### Comprehensive Testing Script ### Comprehensive Testing Script
@ -197,6 +204,7 @@ To run the test script:
``` ```
This script performs the following actions: This script performs the following actions:
1. Builds all Docker images (full, ultra-lite, fat) 1. Builds all Docker images (full, ultra-lite, fat)
2. Runs each version to ensure it starts correctly 2. Runs each version to ensure it starts correctly
3. Executes Cucumber tests against main version and ensures feature compatibility, in the event these tests fail your PR will not be merged 3. Executes Cucumber tests against main version and ensures feature compatibility, in the event these tests fail your PR will not be merged
@ -209,7 +217,6 @@ Note: The `test.sh` script will run automatically when you raise a PR. However,
2. Access the application at `http://localhost:8080` and manually test all features developed. 2. Access the application at `http://localhost:8080` and manually test all features developed.
### Local Testing (Java and UI Components) ### Local Testing (Java and UI Components)
For quick iterations and development of Java backend, JavaScript, and UI components, you can run and test Stirling-PDF locally without Docker. This approach allows you to work on and verify changes to: For quick iterations and development of Java backend, JavaScript, and UI components, you can run and test Stirling-PDF locally without Docker. This approach allows you to work on and verify changes to:
@ -223,7 +230,8 @@ For quick iterations and development of Java backend, JavaScript, and UI compone
To run Stirling-PDF locally: To run Stirling-PDF locally:
1. Compile and run the project using built in IDE methods or by running: 1. Compile and run the project using built in IDE methods or by running:
```
```bash
./gradlew bootRun ./gradlew bootRun
``` ```
@ -234,11 +242,11 @@ To run Stirling-PDF locally:
4. For API changes, use tools like Postman or curl to test endpoints directly. 4. For API changes, use tools like Postman or curl to test endpoints directly.
Important notes: Important notes:
- Local testing doesn't include features that depend on external tools like OCRmyPDF, LibreOffice, or Python scripts. - Local testing doesn't include features that depend on external tools like OCRmyPDF, LibreOffice, or Python scripts.
- There are currently no automated unit tests. All testing is done manually through the UI or API calls. (You are welcome to add JUnits!) - There are currently no automated unit tests. All testing is done manually through the UI or API calls. (You are welcome to add JUnits!)
- Always verify your changes in the full Docker environment before submitting pull requests, as some integrations and features will only work in the complete setup. - Always verify your changes in the full Docker environment before submitting pull requests, as some integrations and features will only work in the complete setup.
## 7. Contributing ## 7. Contributing
1. Fork the repository on GitHub. 1. Fork the repository on GitHub.
@ -246,14 +254,17 @@ Important notes:
3. Make your changes and commit them with clear, descriptive messages and ensure any documentation is updated related to your changes. 3. Make your changes and commit them with clear, descriptive messages and ensure any documentation is updated related to your changes.
4. Test your changes thoroughly in the Docker environment. 4. Test your changes thoroughly in the Docker environment.
5. Run the `test.sh` script to ensure all versions build correctly and pass the Cucumber tests: 5. Run the `test.sh` script to ensure all versions build correctly and pass the Cucumber tests:
```bash ```bash
./test.sh ./test.sh
``` ```
6. Push your changes to your fork. 6. Push your changes to your fork.
7. Submit a pull request to the main repository. 7. Submit a pull request to the main repository.
8. See additional [contributing guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) 8. See additional [contributing guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
When you raise a PR: When you raise a PR:
- The `test.sh` script will run automatically against your PR. - The `test.sh` script will run automatically against your PR.
- The PR checks will verify versioning and dependency updates. - The PR checks will verify versioning and dependency updates.
- Documentation will be automatically updated for dependency changes. - Documentation will be automatically updated for dependency changes.
@ -268,6 +279,7 @@ API documentation is available at `/swagger-ui/index.html` when running the appl
## 9. Customization ## 9. Customization
Stirling-PDF can be customized through environment variables or a `settings.yml` file. Key customization options include: Stirling-PDF can be customized through environment variables or a `settings.yml` file. Key customization options include:
- Application name and branding - Application name and branding
- Security settings - Security settings
- UI customization - UI customization
@ -276,7 +288,8 @@ Stirling-PDF can be customized through environment variables or a `settings.yml`
When using Docker, pass environment variables using the `-e` flag or in your `docker-compose.yml` file. When using Docker, pass environment variables using the `-e` flag or in your `docker-compose.yml` file.
Example: Example:
```
```bash
docker run -p 8080:8080 -e APP_NAME="My PDF Tool" stirling-pdf:full docker run -p 8080:8080 -e APP_NAME="My PDF Tool" stirling-pdf:full
``` ```
@ -293,16 +306,14 @@ For managing language translations that affect multiple files, Stirling-PDF prov
This script helps you make consistent replacements across language files. This script helps you make consistent replacements across language files.
When contributing translations: When contributing translations:
1. Use the helper script for multi-file changes. 1. Use the helper script for multi-file changes.
2. Ensure all language files are updated consistently. 2. Ensure all language files are updated consistently.
3. The PR checks will verify consistency in language file updates. 3. The PR checks will verify consistency in language file updates.
Remember to test your changes thoroughly to ensure they don't break any existing functionality. Remember to test your changes thoroughly to ensure they don't break any existing functionality.
## Code examples
# Code examples
### Overview of Thymeleaf ### Overview of Thymeleaf
@ -311,22 +322,28 @@ Thymeleaf is a server-side Java HTML template engine. It is used in Stirling-PD
### Thymeleaf overview ### Thymeleaf overview
In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content. In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content.
Some examples of this are
Some examples of this are:
```html ```html
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
or or
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> <th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
``` ```
Where it uses the th:block, th: indicating its a special thymeleaf element to be used serverside in generating the html, and block being the actual element type. Where it uses the th:block, th: indicating its a special thymeleaf element to be used serverside in generating the html, and block being the actual element type.
In this case we are inserting the ``navbar`` entry within the ``fragments/navbar.html`` fragment into the ``th:block`` element. In this case we are inserting the ``navbar`` entry within the ``fragments/navbar.html`` fragment into the ``th:block`` element.
They can be more complex such as They can be more complex such as:
```html ```html
<th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}"></th:block> <th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}"></th:block>
``` ```
Which is the same as above but passes the parameters title and header into the fragment common.html to be used in its HTML generation Which is the same as above but passes the parameters title and header into the fragment common.html to be used in its HTML generation
Thymeleaf can also be used to loop through objects or pass things from java side into html side. Thymeleaf can also be used to loop through objects or pass things from java side into html side.
```java ```java
@GetMapping @GetMapping
public String newFeaturePage(Model model) { public String newFeaturePage(Model model) {
@ -334,7 +351,9 @@ Thymeleaf can also be used to loop through objects or pass things from java side
return "new-feature"; return "new-feature";
} }
``` ```
in above example if exampleData is a list of plain java objects of class Person and within it you had id, name, age etc. You can reference it like so in above example if exampleData is a list of plain java objects of class Person and within it you had id, name, age etc. You can reference it like so
```html ```html
<tbody> <tbody>
<!-- Use th:each to iterate over the list --> <!-- Use th:each to iterate over the list -->
@ -346,6 +365,7 @@ in above example if exampleData is a list of plain java objects of class Person
</tr> </tr>
</tbody> </tbody>
``` ```
This would generate n entries of tr for each person in exampleData This would generate n entries of tr for each person in exampleData
### Adding a New Feature to the Backend (API) ### Adding a New Feature to the Backend (API)
@ -397,6 +417,7 @@ This would generate n entries of tr for each person in exampleData
``` ```
2b. **Integrate the Service with the Controller:** 2b. **Integrate the Service with the Controller:**
- Autowire the service class in the controller and use it to handle the API request. - Autowire the service class in the controller and use it to handle the API request.
```java ```java
@ -511,7 +532,6 @@ This would generate n entries of tr for each person in exampleData
</li> </li>
``` ```
## Adding New Translations to Existing Language Files in Stirling-PDF ## Adding New Translations to Existing Language Files in Stirling-PDF
When adding a new feature or modifying existing ones in Stirling-PDF, you'll need to add new translation entries to the existing language files. Here's a step-by-step guide: When adding a new feature or modifying existing ones in Stirling-PDF, you'll need to add new translation entries to the existing language files. Here's a step-by-step guide:
@ -522,8 +542,8 @@ Find the existing `messages.properties` files in the `src/main/resources` direct
- `messages.properties` (default, usually English) - `messages.properties` (default, usually English)
- `messages_en_GB.properties` - `messages_en_GB.properties`
- `messages_fr.properties` - `messages_fr_FR.properties`
- `messages_de.properties` - `messages_de_DE.properties`
- etc. - etc.
### 2. Add New Translation Entries ### 2. Add New Translation Entries
@ -552,6 +572,4 @@ In your Thymeleaf templates, use the `#{key}` syntax to reference the new transl
<button th:text="#{pdfSplitter.button.split}">Split PDF</button> <button th:text="#{pdfSplitter.button.split}">Split PDF</button>
``` ```
Remember, never hard-code text in your templates or Java code. Always use translation keys to ensure proper localization. Remember, never hard-code text in your templates or Java code. Always use translation keys to ensure proper localization.

View File

@ -1,33 +1,41 @@
## User Guide for Local Directory Scanning and File Processing ## User Guide for Local Directory Scanning and File Processing
### Setting Up Watched Folders: ### Setting Up Watched Folders
- Create a folder where you want your files to be monitored. This is your 'watched folder'. - Create a folder where you want your files to be monitored. This is your 'watched folder'.
- The default directory for this is `./pipeline/watchedFolders/` - The default directory for this is `./pipeline/watchedFolders/`.
- Place any directories you want to be scanned into this folder, this folder should contain multiple folders each for their own tasks and pipelines. - Place any directories you want to be scanned into this folder. This folder should contain multiple folders, each for their own tasks and pipelines.
### Configuring Processing with JSON Files: ### Configuring Processing with JSON Files
- In each directory you want processed (e.g `./pipeline/watchedFolders/officePrinter`), include a JSON configuration file.
- This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them) which can be made, configured and downloaded from Stirling-PDF Pipeline interface.r - In each directory you want processed (e.g., `./pipeline/watchedFolders/officePrinter`), include a JSON configuration file.
- This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them). This can be made, configured, and downloaded from the Stirling-PDF Pipeline interface.
### Automatic Scanning and Processing
### Automatic Scanning and Processing:
- The system automatically checks the watched folder every minute for new directories and files to process. - The system automatically checks the watched folder every minute for new directories and files to process.
- When a directory with a valid JSON configuration file is found, it begins processing the files inside as per the configuration. - When a directory with a valid JSON configuration file is found, it begins processing the files inside according to the configuration.
### Processing Steps
### Processing Steps:
- Files in each directory are processed according to the instructions in the JSON file. - Files in each directory are processed according to the instructions in the JSON file.
- This might involve file conversions, data filtering, renaming files, etc. If the output of a step is a zip, this zip will be automatically unzipped as it passes to next process. - This might involve file conversions, data filtering, renaming files, etc. If the output of a step is a zip, this zip will be automatically unzipped as it passes to the next process.
### Results and Output
### Results and Output:
- After processing, the results are saved in a specified output location. This could be a different folder or location as defined in the JSON file or the default location `./pipeline/finishedFolders/`. - After processing, the results are saved in a specified output location. This could be a different folder or location as defined in the JSON file or the default location `./pipeline/finishedFolders/`.
- Each processed file is named and organized according to the rules set in the JSON configuration. - Each processed file is named and organized according to the rules set in the JSON configuration.
### Completion and Cleanup: ### Completion and Cleanup
- Once processing is complete, the original files in the watched folder's directory are removed. - Once processing is complete, the original files in the watched folder's directory are removed.
- You can find the processed files in the designated output location. - You can find the processed files in the designated output location.
### Error Handling: ### Error Handling
- If there's an error during processing, the system will not delete the original files, allowing you to check and retry if necessary. - If there's an error during processing, the system will not delete the original files, allowing you to check and retry if necessary.
### User Interaction: ### User Interaction
- As a user, your main tasks are to set up the watched folders, place directories with files for processing, and create the corresponding JSON configuration files. - As a user, your main tasks are to set up the watched folders, place directories with files for processing, and create the corresponding JSON configuration files.
- The system handles the rest, including scanning, processing, and outputting results. - The system handles the rest, including scanning, processing, and outputting results.

View File

@ -1,43 +1,47 @@
<p align="center"><img src="https://raw.githubusercontent.com/Stirling-Tools/Stirling-PDF/main/docs/stirling.png" width="80" ><br><h1 align="center">Stirling-PDF</h1> <p align="center">
<img src="https://raw.githubusercontent.com/Stirling-Tools/Stirling-PDF/main/docs/stirling.png" width="80">
<br>
<h1 align="center">Stirling-PDF</h1>
</p> </p>
# How to add new languages to Stirling-PDF # How to add new languages to Stirling-PDF
Fork Stirling-PDF and make a new branch out of Main Fork Stirling-PDF and create a new branch out of `main`.
Then add reference to the language in the navbar by adding a new language entry to the dropdown Then add a reference to the language in the navbar by adding a new language entry to the dropdown:
https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/languages.html - Edit the file: [languages.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/languages.html)
and add a flag svg file to - Add a flag SVG file to: [flags directory](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/static/images/flags)
https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/static/images/flags
Any SVG flags are fine, i got most of mine from [here](https://flagicons.lipis.dev/)
If your language isn't represented by a flag just find whichever closely matches it, such as for Arabic i chose Saudi Arabia
For example to add Polish you would add Any SVG flags are fine; most of the current ones were sourced from [here](https://flagicons.lipis.dev/). If your language isn't represented by a flag, choose a similar one, such as Saudi Arabia's flag for Arabic.
For example, to add Polish, you would add:
```html ```html
<a class="dropdown-item lang_dropdown-item" href="" data-language-code="pl_PL"> <a class="dropdown-item lang_dropdown-item" href="" data-bs-language-code="pl_PL">
<img src="images/flags/pl.svg" alt="icon" width="20" height="15"> Polski <img src="images/flags/pl.svg" alt="icon" width="20" height="15"> Polski
</a> </a>
``` ```
The data-language-code is the code used to reference the file in the next step. The `data-bs-language-code` is the code used to reference the file in the next step.
Start by copying the existing english property file ### Add Language Property File
[https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties) Start by copying the existing English property file:
Copy and rename it to messages_{your data-language-code here}.properties, in the polish example you would set the name to messages_pl_PL.properties - [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)
Then simply translate all property entries within that file and make a PR into main for others to use! Copy and rename it to `messages_{your data-bs-language-code here}.properties`. In the Polish example, you would set the name to `messages_pl_PL.properties`.
If you do not have a java IDE i am happy to verify the changes worked once you raise PR (but won't be able to verify the translations themselves) Then simply translate all property entries within that file and make a Pull Request (PR) into `main` for others to use!
If you do not have a Java IDE, I am happy to verify that the changes work once you raise the PR (but I won't be able to verify the translations themselves).
## Handling Untranslatable Strings ## Handling Untranslatable Strings
Sometimes, certain strings in the properties file may not require translation because they are the same in the target language or are universal (like names of protocols, certain terminologies, etc.). To ensure accurate statistics for language progress, these strings should be added to the `ignore_translation.toml` file located in the `scripts` directory. This will exclude them from the translation progress calculations. Sometimes, certain strings in the properties file may not require translation because they are the same in the target language or are universal (like names of protocols, certain terminologies, etc.). To ensure accurate statistics for language progress, these strings should be added to the `ignore_translation.toml` file located in the `scripts` directory. This will exclude them from the translation progress calculations.
For example, if the English string error=Error does not need translation in Polish, add it to the ignore_translation.toml under the Polish section: For example, if the English string `error=Error` does not need translation in Polish, add it to the `ignore_translation.toml` under the Polish section:
```toml ```toml
[pl_PL] [pl_PL]
@ -49,7 +53,9 @@ ignore = [
## Add New Translation Tags ## Add New Translation Tags
- **Important**: If you add any new translation tags, they must first be added to the `messages_en_GB.properties` file. This ensures consistency across all language files. > [!IMPORTANT]
> If you add any new translation tags, they must first be added to the `messages_en_GB.properties` file. This ensures consistency across all language files.
- New translation tags **must be added** to the `messages_en_GB.properties` file to maintain a reference for other languages. - New translation tags **must be added** to the `messages_en_GB.properties` file to maintain a reference for other languages.
- After adding the new tags to `messages_en_GB.properties`, add and translate them in the respective language file (e.g., `messages_pl_PL.properties`). - After adding the new tags to `messages_en_GB.properties`, add and translate them in the respective language file (e.g., `messages_pl_PL.properties`).

View File

@ -3,34 +3,36 @@
This document provides instructions on how to add additional language packs for the OCR tab in Stirling-PDF, both inside and outside of Docker. This document provides instructions on how to add additional language packs for the OCR tab in Stirling-PDF, both inside and outside of Docker.
## My OCR used to work and now doesn't! ## My OCR used to work and now doesn't!
The paths have changed for the tessadata locations on new docker images, please use ``/usr/share/tessdata`` (Others should still work for backwards compatibility but might not)
The paths have changed for the tessdata locations on new Docker images. Please use `/usr/share/tessdata` (Others should still work for backward compatibility but might not).
## How does the OCR Work ## How does the OCR Work
Stirling-PDF uses [OCRmyPDF](https://github.com/ocrmypdf/OCRmyPDF) which in turn uses tesseract for its text recognition.
All credit goes to them for this awesome work! Stirling-PDF uses [OCRmyPDF](https://github.com/ocrmypdf/OCRmyPDF), which in turn uses Tesseract for its text recognition. All credit goes to them for this awesome work!
## Language Packs ## Language Packs
Tesseract OCR supports a variety of languages. You can find additional language packs in the Tesseract GitHub repositories: Tesseract OCR supports a variety of languages. You can find additional language packs in the Tesseract GitHub repositories:
- [tessdata_fast](https://github.com/tesseract-ocr/tessdata_fast): These language packs are smaller and faster to load, but may provide lower recognition accuracy. - [tessdata_fast](https://github.com/tesseract-ocr/tessdata_fast): These language packs are smaller and faster to load but may provide lower recognition accuracy.
- [tessdata](https://github.com/tesseract-ocr/tessdata): These language packs are larger and provide better recognition accuracy, but may take longer to load. - [tessdata](https://github.com/tesseract-ocr/tessdata): These language packs are larger and provide better recognition accuracy, but may take longer to load.
Depending on your requirements, you can choose the appropriate language pack for your use case. By default Stirling-PDF uses the tessdata_fast eng but this can be replaced. Depending on your requirements, you can choose the appropriate language pack for your use case. By default, Stirling-PDF uses `tessdata_fast` for English, but this can be replaced.
### Installing Language Packs ### Installing Language Packs
1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. 1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need.
2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` 2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata`
# DO NOT REMOVE EXISTING ENG.TRAINEDDATA, IT'S REQUIRED. **DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED.**
#### Docker ### Docker Setup
If you are using Docker, you need to expose the Tesseract tessdata directory as a volume in order to use the additional language packs. If you are using Docker, you need to expose the Tesseract tessdata directory as a volume in order to use the additional language packs.
#### Docker Compose
Modify your `docker-compose.yml` file to include the following volume configuration:
#### Docker Compose
Modify your `docker-compose.yml` file to include the following volume configuration:
```yaml ```yaml
services: services:
@ -40,18 +42,19 @@ services:
- /location/of/trainingData:/usr/share/tessdata - /location/of/trainingData:/usr/share/tessdata
``` ```
#### Docker Run
Add the following to your existing Docker run command:
#### Docker run
Add the following to your existing docker run command
```bash ```bash
-v /location/of/trainingData:/usr/share/tessdata -v /location/of/trainingData:/usr/share/tessdata
``` ```
#### Non-Docker ### Non-Docker Setup
If you are not using Docker, you need to install the OCR components, including the ocrmypdf app.
You can see [OCRmyPDF install guide](https://ocrmypdf.readthedocs.io/en/latest/installation.html)
Debian based systems, install languages with this command: If you are not using Docker, you need to install the OCR components, including the `ocrmypdf` app. You can see the [OCRmyPDF install guide](https://ocrmypdf.readthedocs.io/en/latest/installation.html).
For Debian-based systems, install languages with this command:
```bash ```bash
sudo apt update &&\ sudo apt update &&\
@ -65,7 +68,7 @@ apt search tesseract-ocr-
dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g' dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g'
``` ```
Fedora: For Fedora:
```bash ```bash
# All languages # All languages

View File

@ -1,41 +1,28 @@
To run the application without Docker/Podman, you will need to manually install all dependencies and build the necessary components. To run the application without Docker/Podman, you will need to manually install all dependencies and build the necessary components.
Note that some dependencies might not be available in the standard repositories of all Linux distributions, and may require additional steps to install. Note that some dependencies might not be available in the standard repositories of all Linux distributions, and may require additional steps to install.
The following guide assumes you have a basic understanding of using a command line interface in your operating system. The following guide assumes you have a basic understanding of using a command line interface in your operating system.
It should work on most Linux distributions and MacOS. For Windows, you might need to use Windows Subsystem for Linux (WSL) for certain steps. It should work on most Linux distributions and MacOS. For Windows, you might need to use Windows Subsystem for Linux (WSL) for certain steps. The amount of dependencies is to actually reduce overall size, i.e., installing LibreOffice subcomponents rather than the full LibreOffice package.
The amount of dependencies is to actually reduce overall size, ie installing LibreOffice sub components rather than full LibreOffice package.
You could theoretically use a Distrobox/Toolbox, if your Distribution has old or not all Packages. But you might just as well use the Docker Container then. You could theoretically use a Distrobox/Toolbox if your distribution has old or not all packages. But you might just as well use the Docker container then.
### Step 1: Prerequisites ### Step 1: Prerequisites
Install the following software, if not already installed: Install the following software, if not already installed:
- Java 17 or later (21 recommended) - Java 17 or later (21 recommended)
- Gradle 7.0 or later (included within repo so not needed on server) - Gradle 7.0 or later (included within repo so not needed on server)
- Git - Git
- Python 3.8 (with pip) - Python 3.8 (with pip)
- Make - Make
- GCC/G++ - GCC/G++
- Automake - Automake
- Autoconf - Autoconf
- libtool - libtool
- pkg-config - pkg-config
- zlib1g-dev - zlib1g-dev
- libleptonica-dev - libleptonica-dev
For Debian-based systems, you can use the following command: For Debian-based systems, you can use the following command:
@ -52,6 +39,7 @@ sudo dnf install -y git automake autoconf libtool leptonica-devel pkg-config zli
``` ```
For non-root users with Nix Package Manager, use the following command: For non-root users with Nix Package Manager, use the following command:
```bash ```bash
nix-channel --update nix-channel --update
nix-env -iA nixpkgs.jdk21 nixpkgs.git nixpkgs.python38 nixpkgs.gnumake nixpkgs.libgcc nixpkgs.automake nixpkgs.autoconf nixpkgs.libtool nixpkgs.pkg-config nixpkgs.zlib nixpkgs.leptonica nix-env -iA nixpkgs.jdk21 nixpkgs.git nixpkgs.python38 nixpkgs.gnumake nixpkgs.libgcc nixpkgs.automake nixpkgs.autoconf nixpkgs.libtool nixpkgs.pkg-config nixpkgs.zlib nixpkgs.leptonica
@ -73,35 +61,27 @@ sudo make install
``` ```
For Nix, you will face `Leptonica not detected`. Bypass this by installing it directly using the following command: For Nix, you will face `Leptonica not detected`. Bypass this by installing it directly using the following command:
```bash ```bash
nix-env -iA nixpkgs.jbig2enc nix-env -iA nixpkgs.jbig2enc
``` ```
### Step 3: Install Additional Software ### Step 3: Install Additional Software
Next we need to install LibreOffice for conversions, ocrmypdf for OCR, and opencv for pattern recognition functionality.
Next we need to install LibreOffice for conversions, ocrmypdf for OCR, and OpenCV for pattern recognition functionality.
Install the following software: Install the following software:
- libreoffice-core - libreoffice-core
- libreoffice-common - libreoffice-common
- libreoffice-writer - libreoffice-writer
- libreoffice-calc - libreoffice-calc
- libreoffice-impress - libreoffice-impress
- python3-uno - python3-uno
- unoconv - unoconv
- pngquant - pngquant
- unpaper - unpaper
- ocrmypdf - ocrmypdf
- opencv-python-headless - opencv-python-headless
For Debian-based systems, you can use the following command: For Debian-based systems, you can use the following command:
@ -135,12 +115,9 @@ chmod +x ./gradlew &&\
./gradlew build ./gradlew build
``` ```
### Step 5: Move jar to desired location ### Step 5: Move Jar to Desired Location
After the build process, a `.jar` file will be generated in the `build/libs` directory. After the build process, a `.jar` file will be generated in the `build/libs` directory. You can move this file to a desired location, for example, `/opt/Stirling-PDF/`. You must also move the Script folder within the Stirling-PDF repo that you have downloaded to this directory. This folder is required for the Python scripts using OpenCV.
You can move this file to a desired location, for example, `/opt/Stirling-PDF/`.
You must also move the Script folder within the Stirling-PDF repo that you have downloaded to this directory.
This folder is required for the python scripts using OpenCV.
```bash ```bash
sudo mkdir /opt/Stirling-PDF && \ sudo mkdir /opt/Stirling-PDF && \
@ -150,18 +127,22 @@ echo "Scripts installed."
``` ```
For non-root users, you can just keep the jar in the main directory of Stirling-PDF using the following command: For non-root users, you can just keep the jar in the main directory of Stirling-PDF using the following command:
```bash ```bash
mv ./build/libs/Stirling-PDF-*.jar ./Stirling-PDF-*.jar mv ./build/libs/Stirling-PDF-*.jar ./Stirling-PDF-*.jar
``` ```
### Step 6: Other files ### Step 6: Other Files
#### OCR #### OCR
If you plan to use the OCR (Optical Character Recognition) functionality, you might need to install language packs for Tesseract if running non-english scanning.
If you plan to use the OCR (Optical Character Recognition) functionality, you might need to install language packs for Tesseract if running non-English scanning.
##### Installing Language Packs ##### Installing Language Packs
Easiest is to use the langpacks provided by your repositories. Skip the other steps.
Manual: The easiest method is to use the language packs provided by your repositories. Skip the other steps if they are available.
**Manual:**
1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. 1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need.
2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` 2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata`
@ -169,7 +150,7 @@ Manual:
**IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED. **IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED.
Debian based systems, install languages with this command: **Debian-based systems**, install languages with this command:
```bash ```bash
sudo apt update && \ sudo apt update && \
@ -183,7 +164,7 @@ apt search tesseract-ocr-
dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g' dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g'
``` ```
Fedora: **Fedora:**
```bash ```bash
# All languages # All languages
@ -196,13 +177,13 @@ dnf search -C tesseract-langpack-
rpm -qa | grep tesseract-langpack | sed 's/tesseract-langpack-//g' rpm -qa | grep tesseract-langpack | sed 's/tesseract-langpack-//g'
``` ```
Nix: **Nix:**
```bash ```bash
nix-env -iA nixpkgs.tesseract nix-env -iA nixpkgs.tesseract
``` ```
**Note:** Nix Package Manager pre-installs almost all the language packs when tesseract is installed. **Note:** Nix Package Manager pre-installs almost all the language packs when Tesseract is installed.
### Step 7: Run Stirling-PDF ### Step 7: Run Stirling-PDF
@ -214,11 +195,13 @@ or
java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar
``` ```
Since libreoffice, soffice, and conversion tools have their dbus_tmp_dir set as `dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"`, you might get the following error when using their endpoints: Since LibreOffice, soffice, and conversion tools have their dbus_tmp_dir set as `dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"`, you might get the following error when using their endpoints:
``` ```
[Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory /run/user/1501: Permission denied [Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory /run/user/1501: Permission denied
``` ```
To resolve this, before starting the Stirling-PDF, you have to set the environment variable to a directory you have write access to by using the following commands:
To resolve this, before starting Stirling-PDF, you have to set the environment variable to a directory you have write access to by using the following commands:
```bash ```bash
mkdir temp mkdir temp
@ -228,9 +211,10 @@ or
java -jar ./Stirling-PDF-*.jar java -jar ./Stirling-PDF-*.jar
``` ```
### Step 8: Adding a Desktop icon ### Step 8: Adding a Desktop Icon
This will add a modified app starter to your app menu.
This will add a modified Appstarter to your Appmenu.
```bash ```bash
location=$(pwd)/gradlew location=$(pwd)/gradlew
image=$(pwd)/docs/stirling-transparent.svg image=$(pwd)/docs/stirling-transparent.svg
@ -251,35 +235,40 @@ EOF
Note: Currently the app will run in the background until manually closed. Note: Currently the app will run in the background until manually closed.
### Optional: Changing the host and port of the application: ### Optional: Changing the Host and Port of the Application
To override the default configuration, you can add the following to `/.git/Stirling-PDF/configs/custom_settings.yml` file: To override the default configuration, you can add the following to `/.git/Stirling-PDF/configs/custom_settings.yml` file:
```bash ```yaml
server: server:
host: 0.0.0.0 # Not working - use instead address host: 0.0.0.0 # Not working - use instead address
address: 0.0.0.0 address: 0.0.0.0
port: 3000 port: 3000
``` ```
'-Djava.net.preferIPv4Stack=true' --> To force ipv4 only in the java starting command
`-Djava.net.preferIPv4Stack=true` --> To force IPv4 only in the Java starting command
**Note:** This file is created after the first application launch. To have it before that, you can create the directory and add the file yourself. **Note:** This file is created after the first application launch. To have it before that, you can create the directory and add the file yourself.
### Optional: Run Stirling-PDF as a service (requires root). ### Optional: Run Stirling-PDF as a Service (requires root)
First create a .env file, where you can store environment variables: First create a `.env` file, where you can store environment variables:
```
```bash
touch /opt/Stirling-PDF/.env touch /opt/Stirling-PDF/.env
``` ```
In this file you can add all variables, one variable per line, as stated in the main readme (for example SYSTEM_DEFAULTLOCALE="de-DE").
Create a new file where we store our service settings and open it with nano editor: In this file, you can add all variables, one variable per line, as stated in the main readme (for example `SYSTEM_DEFAULTLOCALE="de-DE"`).
```
Create a new file where we store our service settings and open it with the nano editor:
```bash
nano /etc/systemd/system/stirlingpdf.service nano /etc/systemd/system/stirlingpdf.service
``` ```
Paste this content, make sure to update the filename of the jar-file. Press Ctrl+S and Ctrl+X to save and exit the nano editor: Paste this content, make sure to update the filename of the jar file. Press `Ctrl+S` and `Ctrl+X` to save and exit the nano editor:
```
```ini
[Unit] [Unit]
Description=Stirling-PDF service Description=Stirling-PDF service
After=syslog.target network.target After=syslog.target network.target
@ -303,22 +292,25 @@ WantedBy=multi-user.target
Notify systemd that it has to rebuild its internal service database (you have to run this command every time you make a change in the service file): Notify systemd that it has to rebuild its internal service database (you have to run this command every time you make a change in the service file):
``` ```bash
sudo systemctl daemon-reload sudo systemctl daemon-reload
``` ```
Enable the service to tell the service to start it automatically: Enable the service to tell it to start automatically:
```
```bash
sudo systemctl enable stirlingpdf.service sudo systemctl enable stirlingpdf.service
``` ```
See the status of the service: See the status of the service:
```
```bash
sudo systemctl status stirlingpdf.service sudo systemctl status stirlingpdf.service
``` ```
Manually start/stop/restart the service: Manually start/stop/restart the service:
```
```bash
sudo systemctl start stirlingpdf.service sudo systemctl start stirlingpdf.service
sudo systemctl stop stirlingpdf.service sudo systemctl stop stirlingpdf.service
sudo systemctl restart stirlingpdf.service sudo systemctl restart stirlingpdf.service
@ -326,12 +318,11 @@ sudo systemctl restart stirlingpdf.service
--- ---
Remember to set the necessary environment variables before running the project if you want to customize the application the list can be seen in the main readme. Remember to set the necessary environment variables before running the project if you want to customize the application. The list can be seen in the main readme.
You can do this in the terminal by using the `export` command or -D argument to java -jar command: You can do this in the terminal by using the `export` command or `-D` argument to the Java `-jar` command:
```bash ```bash
export APP_HOME_NAME="Stirling PDF" export APP_HOME_NAME="Stirling PDF"
or or
-DAPP_HOME_NAME="Stirling PDF" -DAPP_HOME_NAME="Stirling PDF"
```

View File

@ -1,6 +1,7 @@
# Pipeline Configuration and Usage Tutorial # Pipeline Configuration and Usage Tutorial
- Configure the pipeline config file and input files to run files against it
- For reuse, download the config file and re-upload it when needed, or place it in /pipeline/defaultWebUIConfigs/ to auto-load in the web UI for all users - Configure the pipeline config file and input files to run files against it.
- For reuse, download the config file and re-upload it when needed, or place it in `/pipeline/defaultWebUIConfigs/` to auto-load in the web UI for all users.
## Steps to Configure and Use Your Pipeline ## Steps to Configure and Use Your Pipeline
@ -26,19 +27,16 @@
- Use the **Validation** button to check your pipeline. A green indicator signifies correct setup; a pop-out error indicates issues. - Use the **Validation** button to check your pipeline. A green indicator signifies correct setup; a pop-out error indicates issues.
8. **Download Pipeline Configuration** 8. **Download Pipeline Configuration**
- To use the configuration for folder scanning (or save it for future use and reupload it), you can also download a JSON file in this menu. You can also pre-load this for future use by placing it in ``/pipeline/defaultWebUIConfigs/``. It will then appear in the dropdown menu for all users to use. - To use the configuration for folder scanning (or save it for future use and re-upload it), download a JSON file in this menu. You can also pre-load it for future use by placing it in `/pipeline/defaultWebUIConfigs/`. It will then appear in the dropdown menu for all users to use.
9. **Submit Files for Processing** 9. **Submit Files for Processing**
- If your pipeline is correctly set up close the configure menu, input the files and hit **Submit**. - If your pipeline is correctly set up, close the configure menu, input the files, and hit **Submit**.
10. **Note on Web UI Limitations** 10. **Note on Web UI Limitations**
- The current web UI version does not support operations that require multiple different types of inputs, such as adding a separate image to a PDF. - The current web UI version does not support operations that require multiple different types of inputs, such as adding a separate image to a PDF.
### Current Limitations ### Current Limitations
- Cannot have more than one of the same operation
- Cannot input additional files via UI
- All files and operations run in serial mode
- Cannot have more than one of the same operation.
- Cannot input additional files via UI.
- All files and operations run in serial mode.

317
README.md
View File

@ -9,9 +9,9 @@
[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Stirling-Tools/Stirling-PDF/tree/digitalOcean&refcode=c3210994b1af) [![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Stirling-Tools/Stirling-PDF/tree/digitalOcean&refcode=c3210994b1af)
[<img src="https://www.ssdnodes.com/wp-content/uploads/2023/11/footer-logo.svg" alt="Name" height="40">](https://www.ssdnodes.com/manage/aff.php?aff=2216&register=true) [<img src="https://www.ssdnodes.com/wp-content/uploads/2023/11/footer-logo.svg" alt="Name" height="40">](https://www.ssdnodes.com/manage/aff.php?aff=2216&register=true)
This is a robust, locally hosted web-based PDF manipulation tool using Docker. It enables you to carry out various operations on PDF files, including splitting, merging, converting, reorganizing, adding images, rotating, compressing, and more. This locally hosted web application has evolved to encompass a comprehensive set of features, addressing all your PDF requirements. Stirling-PDF is a robust, locally hosted web-based PDF manipulation tool using Docker. It enables you to carry out various operations on PDF files, including splitting, merging, converting, reorganizing, adding images, rotating, compressing, and more. This locally hosted web application has evolved to encompass a comprehensive set of features, addressing all your PDF requirements.
Stirling PDF does not initiate any outbound calls for record-keeping or tracking purposes. Stirling-PDF does not initiate any outbound calls for record-keeping or tracking purposes.
All files and PDFs exist either exclusively on the client side, reside in server memory only during task execution, or temporarily reside in a file solely for the execution of the task. Any file downloaded by the user will have been deleted from the server by that point. All files and PDFs exist either exclusively on the client side, reside in server memory only during task execution, or temporarily reside in a file solely for the execution of the task. Any file downloaded by the user will have been deleted from the server by that point.
@ -19,7 +19,7 @@ All files and PDFs exist either exclusively on the client side, reside in server
## Features ## Features
- Dark mode support. - Dark mode support
- Custom download options - Custom download options
- Parallel file processing and downloads - Parallel file processing and downloads
- Custom 'Pipelines' to run multiple features in a queue - Custom 'Pipelines' to run multiple features in a queue
@ -27,68 +27,68 @@ All files and PDFs exist either exclusively on the client side, reside in server
- Optional Login and Authentication support (see [here](https://github.com/Stirling-Tools/Stirling-PDF/tree/main#login-authentication) for documentation) - Optional Login and Authentication support (see [here](https://github.com/Stirling-Tools/Stirling-PDF/tree/main#login-authentication) for documentation)
- Database Backup and Import (see [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DATABASE.md) for documentation) - Database Backup and Import (see [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DATABASE.md) for documentation)
## **PDF Features** ## PDF Features
### **Page Operations** ### Page Operations
- View and modify PDFs - View multi page PDFs with custom viewing sorting and searching. Plus on page edit features like annotate, draw and adding text and images. (Using PDF.js with Joxit and Liberation.Liberation fonts) - View and modify PDFs - View multi-page PDFs with custom viewing, sorting, and searching. Plus on-page edit features like annotate, draw, and adding text and images. (Using PDF.js with Joxit and Liberation fonts)
- Full interactive GUI for merging/splitting/rotating/moving PDFs and their pages. - Full interactive GUI for merging/splitting/rotating/moving PDFs and their pages
- Merge multiple PDFs together into a single resultant file. - Merge multiple PDFs into a single resultant file
- Split PDFs into multiple files at specified page numbers or extract all pages as individual files. - Split PDFs into multiple files at specified page numbers or extract all pages as individual files
- Reorganize PDF pages into different orders. - Reorganize PDF pages into different orders
- Rotate PDFs in 90-degree increments. - Rotate PDFs in 90-degree increments
- Remove pages. - Remove pages
- Multi-page layout (Format PDFs into a multi-paged page). - Multi-page layout (format PDFs into a multi-paged page)
- Scale page contents size by set %. - Scale page contents size by set percentage
- Adjust Contrast. - Adjust contrast
- Crop PDF. - Crop PDF
- Auto Split PDF (With physically scanned page dividers). - Auto split PDF (with physically scanned page dividers)
- Extract page(s). - Extract page(s)
- Convert PDF to a single page. - Convert PDF to a single page
- Overlay PDFs on top of each other - Overlay PDFs on top of each other
### **Conversion Operations** ### Conversion Operations
- Convert PDFs to and from images. - Convert PDFs to and from images
- Convert any common file to PDF (using LibreOffice). - Convert any common file to PDF (using LibreOffice)
- Convert PDF to Word/Powerpoint/Others (using LibreOffice). - Convert PDF to Word/PowerPoint/others (using LibreOffice)
- Convert HTML to PDF. - Convert HTML to PDF
- URL to PDF. - URL to PDF
- Markdown to PDF. - Markdown to PDF
### **Security & Permissions** ### Security & Permissions
- Add and remove passwords. - Add and remove passwords
- Change/set PDF Permissions. - Change/set PDF permissions
- Add watermark(s). - Add watermark(s)
- Certify/sign PDFs. - Certify/sign PDFs
- Sanitize PDFs. - Sanitize PDFs
- Auto-redact text. - Auto-redact text
### **Other Operations** ### Other Operations
- Add/Generate/Write signatures. - Add/generate/write signatures
- Repair PDFs. - Repair PDFs
- Detect and remove blank pages. - Detect and remove blank pages
- Compare 2 PDFs and show differences in text. - Compare two PDFs and show differences in text
- Add images to PDFs. - Add images to PDFs
- Compress PDFs to decrease their filesize (Using OCRMyPDF). - Compress PDFs to decrease their filesize (using OCRMyPDF)
- Extract images from PDF. - Extract images from PDF
- Extract images from Scans. - Extract images from scans
- Add page numbers. - Add page numbers
- Auto rename file by detecting PDF header text. - Auto rename file by detecting PDF header text
- OCR on PDF (Using OCRMyPDF). - OCR on PDF (using OCRMyPDF)
- PDF/A conversion (Using OCRMyPDF). - PDF/A conversion (using OCRMyPDF)
- Edit metadata. - Edit metadata
- Flatten PDFs. - Flatten PDFs
- Get all information on a PDF to view or export as JSON. - Get all information on a PDF to view or export as JSON
- Show/Detect embedded Javascript - Show/detect embedded JavaScript
For a overview of the tasks and the technology each uses please view [Endpoint-groups.md](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md) For an overview of the tasks and the technology each uses, please view [Endpoint-groups.md](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md).
Demo of the app is available [here](https://stirlingpdf.io). A demo of the app is available [here](https://stirlingpdf.io).
## Technologies used ## Technologies Used
- Spring Boot + Thymeleaf - Spring Boot + Thymeleaf
- [PDFBox](https://github.com/apache/pdfbox/tree/trunk) - [PDFBox](https://github.com/apache/pdfbox/tree/trunk)
@ -99,27 +99,28 @@ Demo of the app is available [here](https://stirlingpdf.io).
- [PDF.js](https://github.com/mozilla/pdf.js) - [PDF.js](https://github.com/mozilla/pdf.js)
- [PDF-LIB.js](https://github.com/Hopding/pdf-lib) - [PDF-LIB.js](https://github.com/Hopding/pdf-lib)
## How to use ## How to Use
### Windows ### Windows
For windows users download the latest Stirling-PDF.exe from our [release](https://github.com/Stirling-Tools/Stirling-PDF/releases) section or by clicking [here](https://github.com/Stirling-Tools/Stirling-PDF/releases/latest/download/Stirling-PDF.exe)
For Windows users, download the latest Stirling-PDF.exe from our [release](https://github.com/Stirling-Tools/Stirling-PDF/releases) section or by clicking [here](https://github.com/Stirling-Tools/Stirling-PDF/releases/latest/download/Stirling-PDF.exe).
### Locally ### Locally
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LocalRunGuide.md Please view the [LocalRunGuide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LocalRunGuide.md).
### Docker / Podman ### Docker / Podman
https://hub.docker.com/r/frooodle/s-pdf > [!NOTE]
> <https://hub.docker.com/r/frooodle/s-pdf>
Stirling-PDF has three different versions: a full version, an ultra-lite version, and a 'fat' version. Depending on the types of features you use, you may want a smaller image to save on space. To see what the different versions offer, please look at our [version mapping](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Version-groups.md). For people that don't mind space optimization, just use the latest tag.
Stirling PDF has 3 different versions, a Full version and ultra-Lite version as well as a 'Fat' version. Depending on the types of features you use you may want a smaller image to save on space.
To see what the different versions offer please look at our [version mapping](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Version-groups.md)
For people that don't mind about space optimization just use the latest tag.
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest?label=Stirling-PDF%20Full) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest?label=Stirling-PDF%20Full)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest-ultra-lite?label=Stirling-PDF%20Ultra-Lite) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest-ultra-lite?label=Stirling-PDF%20Ultra-Lite)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest-fat?label=Stirling-PDF%20Fat) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest-fat?label=Stirling-PDF%20Fat)
Please note in below examples you may need to change the volume paths as needed, current examples install them to the current working directory Please note in the examples below, you may need to change the volume paths as needed, e.g., `./extraConfigs:/configs` to `/opt/stirlingpdf/extraConfigs:/configs`.
eg ``./extraConfigs:/configs`` to ``/opt/stirlingpdf/extraConfigs:/configs``
### Docker Run ### Docker Run
@ -129,15 +130,13 @@ docker run -d \
-v ./trainingData:/usr/share/tessdata \ -v ./trainingData:/usr/share/tessdata \
-v ./extraConfigs:/configs \ -v ./extraConfigs:/configs \
-v ./logs:/logs \ -v ./logs:/logs \
# Optional customization (not required)
# -v /location/of/customFiles:/customFiles \
-e DOCKER_ENABLE_SECURITY=false \ -e DOCKER_ENABLE_SECURITY=false \
-e INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false \ -e INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false \
-e LANGS=en_GB \ -e LANGS=en_GB \
--name stirling-pdf \ --name stirling-pdf \
frooodle/s-pdf:latest frooodle/s-pdf:latest
Can also add these for customisation but are not required
-v /location/of/customFiles:/customFiles \
``` ```
### Docker Compose ### Docker Compose
@ -162,23 +161,23 @@ services:
Note: Podman is CLI-compatible with Docker, so simply replace "docker" with "podman". Note: Podman is CLI-compatible with Docker, so simply replace "docker" with "podman".
## Enable OCR/Compression feature ## Enable OCR/Compression Feature
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToUseOCR.md Please view the [HowToUseOCR.md](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToUseOCR.md).
## Reuse stored files ## Reuse Stored Files
Certain functionality like ``Sign`` Supports pre-saved files stored at ``/customFiles/signatures/``, image files placed within here will be accesable to be used via webUI Certain functionality like `Sign` supports pre-saved files stored at `/customFiles/signatures/`. Image files placed within here will be accessible to be used via the web UI. Currently, this supports two folder types:
Currently this supports two folder types
- ``/customFiles/signatures/ALL_USERS`` accessible to all users, useful for orginasations were many users use same files or for users not using authentication - `/customFiles/signatures/ALL_USERS`: Accessible to all users, useful for organizations where many users use the same files or for users not using authentication
- ``/customFiles/signatures/{username}`` such as ``/customFiles/signatures/froodle`` accessible to only the ``froodle`` username, private for all others - `/customFiles/signatures/{username}`: Such as `/customFiles/signatures/froodle`, accessible only to the `froodle` username, private for all others
## Supported Languages ## Supported Languages
Stirling PDF currently supports 38! Stirling-PDF currently supports 36 languages!
| Language | Progress | | Language | Progress |
| ------------------------------------------- | -------------------------------------- | | -------------------------------------------- | -------------------------------------- |
| Arabic (العربية) (ar_AR) | ![92%](https://geps.dev/progress/92) | | Arabic (العربية) (ar_AR) | ![92%](https://geps.dev/progress/92) |
| Basque (Euskara) (eu_ES) | ![56%](https://geps.dev/progress/56) | | Basque (Euskara) (eu_ES) | ![56%](https://geps.dev/progress/56) |
| Bulgarian (Български) (bg_BG) | ![98%](https://geps.dev/progress/98) | | Bulgarian (Български) (bg_BG) | ![98%](https://geps.dev/progress/98) |
@ -194,7 +193,7 @@ Stirling PDF currently supports 38!
| Greek (Ελληνικά) (el_GR) | ![75%](https://geps.dev/progress/75) | | Greek (Ελληνικά) (el_GR) | ![75%](https://geps.dev/progress/75) |
| Hindi (हिंदी) (hi_IN) | ![71%](https://geps.dev/progress/71) | | Hindi (हिंदी) (hi_IN) | ![71%](https://geps.dev/progress/71) |
| Hungarian (Magyar) (hu_HU) | ![69%](https://geps.dev/progress/69) | | Hungarian (Magyar) (hu_HU) | ![69%](https://geps.dev/progress/69) |
| Indonesia (Bahasa Indonesia) (id_ID) | ![95%](https://geps.dev/progress/95) | | Indonesian (Bahasa Indonesia) (id_ID) | ![95%](https://geps.dev/progress/95) |
| Irish (Gaeilge) (ga_IE) | ![89%](https://geps.dev/progress/89) | | Irish (Gaeilge) (ga_IE) | ![89%](https://geps.dev/progress/89) |
| Italian (Italiano) (it_IT) | ![99%](https://geps.dev/progress/99) | | Italian (Italiano) (it_IT) | ![99%](https://geps.dev/progress/99) |
| Japanese (日本語) (ja_JP) | ![86%](https://geps.dev/progress/86) | | Japanese (日本語) (ja_JP) | ![86%](https://geps.dev/progress/86) |
@ -216,72 +215,69 @@ Stirling PDF currently supports 38!
| Ukrainian (Українська) (uk_UA) | ![81%](https://geps.dev/progress/81) | | Ukrainian (Українська) (uk_UA) | ![81%](https://geps.dev/progress/81) |
| Vietnamese (Tiếng Việt) (vi_VN) | ![90%](https://geps.dev/progress/90) | | Vietnamese (Tiếng Việt) (vi_VN) | ![90%](https://geps.dev/progress/90) |
## Contributing (creating issues, translations, fixing bugs, etc.) ## Contributing (Creating Issues, Translations, Fixing Bugs, etc.)
Please see our [Contributing Guide](CONTRIBUTING.md)! Please see our [Contributing Guide](CONTRIBUTING.md).
## Customisation ## Customization
Stirling PDF allows easy customization of the app. Stirling-PDF allows easy customization of the app, including things like:
Includes things like
- Custom application name - Custom application name
- Custom slogans, icons, HTML, images CSS etc (via file overrides) - Custom slogans, icons, HTML, images, CSS, etc. (via file overrides)
There are two options for this, either using the generated settings file ``settings.yml`` There are two options for this, either using the generated settings file `settings.yml`, which is located in the `/configs` directory and follows standard YAML formatting, or using environment variables, which would override the settings file.
This file is located in the ``/configs`` directory and follows standard YAML formatting
Environment variables are also supported and would override the settings file For example, in `settings.yml`, you might have:
For example in the settings.yml you have
```yaml ```yaml
security: security:
enableLogin: 'true' enableLogin: 'true'
``` ```
To have this via an environment variable you would have ``SECURITY_ENABLELOGIN`` To have this via an environment variable, you would use `SECURITY_ENABLELOGIN`.
The Current list of settings is The current list of settings is:
```yaml ```yaml
security: security:
enableLogin: false # set to 'true' to enable login enableLogin: false # set to 'true' to enable login
csrfDisabled: true # Set to 'true' to disable CSRF protection (not recommended for production) csrfDisabled: true # set to 'true' to disable CSRF protection (not recommended for production)
loginAttemptCount: 5 # lock user account after 5 tries; when using e.g. Fail2Ban you can deactivate the function with -1 loginAttemptCount: 5 # lock user account after 5 tries; when using e.g. Fail2Ban you can deactivate the function with -1
loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts
loginMethod: all # 'all' (Login Username/Password and OAuth2[must be enabled and configured]), 'normal'(only Login with Username/Password) or 'oauth2'(only Login with OAuth2) loginMethod: all # 'all' (Login Username/Password and OAuth2[must be enabled and configured]), 'normal'(only Login with Username/Password) or 'oauth2'(only Login with OAuth2)
initialLogin: initialLogin:
username: '' # Initial username for the first login username: '' # initial username for the first login
password: '' # Initial password for the first login password: '' # initial password for the first login
oauth2: oauth2:
enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work) enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
client: client:
keycloak: keycloak:
issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint
clientId: '' # Client ID for Keycloak OAuth2 clientId: '' # client ID for Keycloak OAuth2
clientSecret: '' # Client Secret for Keycloak OAuth2 clientSecret: '' # client secret for Keycloak OAuth2
scopes: openid, profile, email # Scopes for Keycloak OAuth2 scopes: openid, profile, email # scopes for Keycloak OAuth2
useAsUsername: preferred_username # Field to use as the username for Keycloak OAuth2 useAsUsername: preferred_username # field to use as the username for Keycloak OAuth2
google: google:
clientId: '' # Client ID for Google OAuth2 clientId: '' # client ID for Google OAuth2
clientSecret: '' # Client Secret for Google OAuth2 clientSecret: '' # client secret for Google OAuth2
scopes: https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile # Scopes for Google OAuth2 scopes: https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile # scopes for Google OAuth2
useAsUsername: email # Field to use as the username for Google OAuth2 useAsUsername: email # field to use as the username for Google OAuth2
github: github:
clientId: '' # Client ID for GitHub OAuth2 clientId: '' # client ID for GitHub OAuth2
clientSecret: '' # Client Secret for GitHub OAuth2 clientSecret: '' # client secret for GitHub OAuth2
scopes: read:user # Scope for GitHub OAuth2 scopes: read:user # scope for GitHub OAuth2
useAsUsername: login # Field to use as the username for GitHub OAuth2 useAsUsername: login # field to use as the username for GitHub OAuth2
issuer: '' # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) end-point issuer: '' # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) endpoint
clientId: '' # Client ID from your provider clientId: '' # client ID from your provider
clientSecret: '' # Client Secret from your provider clientSecret: '' # client secret from your provider
autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
useAsUsername: email # Default is 'email'; custom fields can be used as the username useAsUsername: email # default is 'email'; custom fields can be used as the username
scopes: openid, profile, email # Specify the scopes for which the application will request permissions scopes: openid, profile, email # specify the scopes for which the application will request permissions
provider: google # Set this to your OAuth provider's name, e.g., 'google' or 'keycloak' provider: google # set this to your OAuth provider's name, e.g., 'google' or 'keycloak'
saml2: saml2:
enabled: false # Currently in alpha, not recommended for use yet, enableAlphaFunctionality must be set to true enabled: false # currently in alpha, not recommended for use yet, enableAlphaFunctionality must be set to true
autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
registrationId: stirling registrationId: stirling
@ -289,7 +285,7 @@ security:
idpSingleLogoutUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/slo/saml idpSingleLogoutUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/slo/saml
idpSingleLoginUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/sso/saml idpSingleLoginUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/sso/saml
idpIssuer: http://www.okta.com/externalKey idpIssuer: http://www.okta.com/externalKey
idpCert: classpath:octa.crt idpCert: classpath:okta.crt
privateKey: classpath:saml-private-key.key privateKey: classpath:saml-private-key.key
spCert: classpath:saml-public-cert.crt spCert: classpath:saml-public-cert.crt
@ -298,35 +294,35 @@ enterpriseEdition:
key: 00000000-0000-0000-0000-000000000000 key: 00000000-0000-0000-0000-000000000000
CustomMetadata: CustomMetadata:
autoUpdateMetadata: false # set to 'true' to automatically update metadata with below values autoUpdateMetadata: false # set to 'true' to automatically update metadata with below values
author: username # Supports text such as 'John Doe' or types such as username to autopopulate with users username author: username # supports text such as 'John Doe' or types such as username to autopopulate with user's username
creator: Stirling-PDF # Supports text such as 'Company-PDF' creator: Stirling-PDF # supports text such as 'Company-PDF'
producer: Stirling-PDF # Supports text such as 'Company-PDF' producer: Stirling-PDF # supports text such as 'Company-PDF'
legal: legal:
termsAndConditions: https://www.stirlingpdf.com/terms-and-conditions # URL to the terms and conditions of your application (e.g. https://example.com/terms) Empty string to disable or filename to load from local file in static folder termsAndConditions: https://www.stirlingpdf.com/terms-and-conditions # URL to the terms and conditions of your application (e.g. https://example.com/terms). Empty string to disable or filename to load from local file in static folder
privacyPolicy: https://www.stirlingpdf.com/privacy-policy # URL to the privacy policy of your application (e.g. https://example.com/privacy) Empty string to disable or filename to load from local file in static folder privacyPolicy: https://www.stirlingpdf.com/privacy-policy # URL to the privacy policy of your application (e.g. https://example.com/privacy). Empty string to disable or filename to load from local file in static folder
accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility) Empty string to disable or filename to load from local file in static folder accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility). Empty string to disable or filename to load from local file in static folder
cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie) Empty string to disable or filename to load from local file in static folder cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie). Empty string to disable or filename to load from local file in static folder
impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum) Empty string to disable or filename to load from local file in static folder impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum). Empty string to disable or filename to load from local file in static folder
system: system:
defaultLocale: en-US # Set the default language (e.g. 'de-DE', 'fr-FR', etc) defaultLocale: en-US # set the default language (e.g. 'de-DE', 'fr-FR', etc)
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) enableAlphaFunctionality: false # set to enable functionality which might need more testing before it fully goes live (this feature might make no changes)
showUpdate: false # see when a new update is available showUpdate: false # see when a new update is available
showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true' showUpdateOnlyAdmin: false # only admins can see when a new update is available, depending on showUpdate it must be set to 'true'
customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template HTML files
tessdataDir: /usr/share/tessdata # Path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored. tessdataDir: /usr/share/tessdata # path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored.
enableAnalytics: undefined # Set to 'true' to enable analytics, set to 'false' to disable analytics, for enterprise users this is set to true enableAnalytics: undefined # set to 'true' to enable analytics, set to 'false' to disable analytics; for enterprise users, this is set to true
ui: ui:
appName: '' # Application's visible name appName: '' # application's visible name
homeDescription: '' # Short description or tagline shown on homepage. homeDescription: '' # short description or tagline shown on the homepage
appNameNavbar: '' # Name displayed on the navigation bar appNameNavbar: '' # name displayed on the navigation bar
endpoints: endpoints:
toRemove: [] # List endpoints to disable (e.g. ['img-to-pdf', 'remove-pages']) toRemove: [] # list endpoints to disable (e.g. ['img-to-pdf', 'remove-pages'])
groupsToRemove: [] # List groups to disable (e.g. ['LibreOffice']) groupsToRemove: [] # list groups to disable (e.g. ['LibreOffice'])
metrics: metrics:
enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable
@ -337,63 +333,62 @@ AutomaticallyGenerated:
UUID: example UUID: example
``` ```
There is an additional config file ``/configs/custom_settings.yml`` were users familiar with java and spring application.properties can input their own settings on-top of Stirling-PDFs existing ones There is an additional config file `/configs/custom_settings.yml` where users familiar with Java and Spring `application.properties` can input their own settings on top of Stirling-PDF's existing ones.
### Extra notes ### Extra Notes
- Endpoints. Currently, the endpoints ENDPOINTS_TO_REMOVE and GROUPS_TO_REMOVE can include comma separate lists of endpoints and groups to disable as example ENDPOINTS_TO_REMOVE=img-to-pdf,remove-pages would disable both image-to-pdf and remove pages, GROUPS_TO_REMOVE=LibreOffice Would disable all things that use LibreOffice. You can see a list of all endpoints and groups [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md) - **Endpoints**: Currently, the `ENDPOINTS_TO_REMOVE` and `GROUPS_TO_REMOVE` endpoints can include comma-separated lists of endpoints and groups to disable. For example, `ENDPOINTS_TO_REMOVE=img-to-pdf,remove-pages` would disable both image-to-pdf and remove pages, while `GROUPS_TO_REMOVE=LibreOffice` would disable all things that use LibreOffice. You can see a list of all endpoints and groups [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md).
- customStaticFilePath. Customise static files such as the app logo by placing files in the /customFiles/static/ directory. An example of customising app logo is placing a /customFiles/static/favicon.svg to override current SVG. This can be used to change any images/icons/css/fonts/js etc in Stirling-PDF - **customStaticFilePath**: Customize static files such as the app logo by placing files in the `/customFiles/static/` directory. An example of customizing the app logo is placing `/customFiles/static/favicon.svg` to override the current SVG. This can be used to change any `images/icons/css/fonts/js`, etc. in Stirling-PDF.
### Environment only parameters ### Environment-Only Parameters
- ``SYSTEM_ROOTURIPATH`` ie set to ``/pdf-app`` to Set the application's root URI to ``localhost:8080/pdf-app`` - `SYSTEM_ROOTURIPATH` - Set the application's root URI (e.g. `/pdf-app` to set the root URI to `localhost:8080/pdf-app`)
- ``SYSTEM_CONNECTIONTIMEOUTMINUTES`` to set custom connection timeout values - `SYSTEM_CONNECTIONTIMEOUTMINUTES` - Set custom connection timeout values
- ``DOCKER_ENABLE_SECURITY`` to tell docker to download security jar (required as true for auth login) - `DOCKER_ENABLE_SECURITY` - Set to `true` to download security jar (required for authentication login)
- ``INSTALL_BOOK_AND_ADVANCED_HTML_OPS`` to download calibre onto stirling-pdf enabling pdf to/from book and advanced html conversion - `INSTALL_BOOK_AND_ADVANCED_HTML_OPS` - Download Calibre onto Stirling-PDF to enable PDF to/from book and advanced HTML conversion
- ``LANGS`` to define custom font libraries to install for use for document conversions - `LANGS` - Define custom font libraries to install for document conversions
## API ## API
For those wanting to use Stirling-PDFs backend API to link with their own custom scripting to edit PDFs you can view all existing API documentation For those wanting to use Stirling-PDF's backend API to link with their own custom scripting to edit PDFs, you can view all existing API documentation [here](https://app.swaggerhub.com/apis-docs/Stirling-Tools/Stirling-PDF/), or navigate to `/swagger-ui/index.html` of your Stirling-PDF instance for your version's documentation (or by following the API button in the settings of Stirling-PDF).
[here](https://app.swaggerhub.com/apis-docs/Stirling-Tools/Stirling-PDF/) or navigate to /swagger-ui/index.html of your stirling-pdf instance for your versions documentation (Or by following the API button in your settings of Stirling-PDF)
## Login authentication ## Login Authentication
![stirling-login](images/login-light.png) ![stirling-login](images/login-light.png)
### Prerequisites ### Prerequisites
- User must have the folder ./configs volumed within docker so that it is retained during updates. - User must have the folder `./configs` volumed within Docker so that it is retained during updates.
- Docker users must download the security jar version by setting ``DOCKER_ENABLE_SECURITY`` to ``true`` in environment variables. - Docker users must download the security jar version by setting `DOCKER_ENABLE_SECURITY` to `true` in environment variables.
- Then either enable login via the settings.yml file or via setting ``SECURITY_ENABLE_LOGIN`` to ``true`` - Then either enable login via the `settings.yml` file or set `SECURITY_ENABLE_LOGIN` to `true`.
- Now the initial user will be generated with username ``admin`` and password ``stirling``. On login you will be forced to change the password to a new one. You can also use the environment variables ``SECURITY_INITIALLOGIN_USERNAME`` and ``SECURITY_INITIALLOGIN_PASSWORD`` to set your own straight away (Recommended to remove them after user creation). - Now the initial user will be generated with username `admin` and password `stirling`. On login, you will be forced to change the password to a new one. You can also use the environment variables `SECURITY_INITIALLOGIN_USERNAME` and `SECURITY_INITIALLOGIN_PASSWORD` to set your own credentials straight away (recommended to remove them after user creation).
Once the above has been done, on restart, a new stirling-pdf-DB.mv.db will show if everything worked. Once the above has been done, on restart, a new `stirling-pdf-DB.mv.db` will show if everything worked.
When you login to Stirling PDF you will be redirected to /login page to login with those default credentials. After login everything should function as normal When you log in to Stirling-PDF, you will be redirected to the `/login` page to log in with those default credentials. After login, everything should function as normal.
To access your account settings go to Account settings in the settings cog menu (top right in navbar) This Account settings menu is also where you find your API key. To access your account settings, go to Account Settings in the settings cog menu (top right in the navbar). This Account Settings menu is also where you find your API key.
To add new users go to the bottom of Account settings and hit 'Admin Settings', here you can add new users. The different roles mentioned within this are for rate limiting. This is a Work in progress which will be expanding on more in future To add new users, go to the bottom of Account Settings and hit 'Admin Settings'. Here you can add new users. The different roles mentioned within this are for rate limiting. This is a work in progress and will be expanded on more in the future.
For API usage you must provide a header with 'X-API-Key' and the associated API key for that user. For API usage, you must provide a header with `X-API-Key` and the associated API key for that user.
## FAQ ## FAQ
### Q1: What are your planned features? ### Q1: What are your planned features?
- Progress bar/Tracking - Progress bar/tracking
- Full custom logic pipelines to combine multiple operations together. - Full custom logic pipelines to combine multiple operations together
- Folder support with auto scanning to perform operations on - Folder support with auto-scanning to perform operations on
- Redact text (Via UI not just automated way) - Redact text (via UI, not just automated)
- Add Forms - Add forms
- Multi page layout (Stich PDF pages together) support x rows y columns and custom page sizing - Multi-page layout (stitch PDF pages together) support x rows y columns and custom page sizing
- Fill forms manually or automatically - Fill forms manually or automatically
### Q2: Why is my application downloading .htm files? ### Q2: Why is my application downloading .htm files?
This is an issue caused commonly by your NGINX configuration. The default file upload size for NGINX is 1MB, you need to add the following in your Nginx sites-available file. ``client_max_body_size SIZE;`` Where "SIZE" is 50M for example for 50MB files. This is an issue commonly caused by your NGINX configuration. The default file upload size for NGINX is 1MB. You need to add the following in your Nginx sites-available file: `client_max_body_size SIZE;` (where "SIZE" is 50M for example for 50MB files).
### Q3: Why is my download timing out ### Q3: Why is my download timing out?
NGINX has timeout values by default so if you are running Stirling-PDF behind NGINX you may need to set a timeout value such as adding the config ``proxy_read_timeout 3600;`` NGINX has timeout values by default, so if you are running Stirling-PDF behind NGINX, you may need to set a timeout value, such as adding the config `proxy_read_timeout 3600;`.

View File

@ -1,7 +1,7 @@
|All versions in a Docker environment can download Calibre as a optional extra at runtime to support `book-to-pdf` and `pdf-to-book` using parameter ``INSTALL_BOOK_AND_ADVANCED_HTML_OPS``. |All versions in a Docker environment can download Calibre as a optional extra at runtime to support `book-to-pdf` and `pdf-to-book` using parameter ``INSTALL_BOOK_AND_ADVANCED_HTML_OPS``.
The 'Fat' container contains all those found in 'Full' with security jar along with this Calibre install. The 'Fat' container contains all those found in 'Full' with security jar along with this Calibre install.
Technology | Ultra-Lite | Full | | Technology | Ultra-Lite | Full |
| ---------- | :--------: | :---: | | ---------- | :--------: | :---: |
| Java | ✔️ | ✔️ | | Java | ✔️ | ✔️ |
| JavaScript | ✔️ | ✔️ | | JavaScript | ✔️ | ✔️ |

View File

@ -13,42 +13,42 @@
security: security:
enableLogin: false # set to 'true' to enable login enableLogin: false # set to 'true' to enable login
csrfDisabled: true # Set to 'true' to disable CSRF protection (not recommended for production) csrfDisabled: true # set to 'true' to disable CSRF protection (not recommended for production)
loginAttemptCount: 5 # lock user account after 5 tries; when using e.g. Fail2Ban you can deactivate the function with -1 loginAttemptCount: 5 # lock user account after 5 tries; when using e.g. Fail2Ban you can deactivate the function with -1
loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts
loginMethod: all # 'all' (Login Username/Password and OAuth2[must be enabled and configured]), 'normal'(only Login with Username/Password) or 'oauth2'(only Login with OAuth2) loginMethod: all # 'all' (Login Username/Password and OAuth2[must be enabled and configured]), 'normal'(only Login with Username/Password) or 'oauth2'(only Login with OAuth2)
initialLogin: initialLogin:
username: '' # Initial username for the first login username: '' # initial username for the first login
password: '' # Initial password for the first login password: '' # initial password for the first login
oauth2: oauth2:
enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work) enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
client: client:
keycloak: keycloak:
issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint
clientId: '' # Client ID for Keycloak OAuth2 clientId: '' # client ID for Keycloak OAuth2
clientSecret: '' # Client Secret for Keycloak OAuth2 clientSecret: '' # client secret for Keycloak OAuth2
scopes: openid, profile, email # Scopes for Keycloak OAuth2 scopes: openid, profile, email # scopes for Keycloak OAuth2
useAsUsername: preferred_username # Field to use as the username for Keycloak OAuth2 useAsUsername: preferred_username # field to use as the username for Keycloak OAuth2
google: google:
clientId: '' # Client ID for Google OAuth2 clientId: '' # client ID for Google OAuth2
clientSecret: '' # Client Secret for Google OAuth2 clientSecret: '' # client secret for Google OAuth2
scopes: https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile # Scopes for Google OAuth2 scopes: https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile # scopes for Google OAuth2
useAsUsername: email # Field to use as the username for Google OAuth2 useAsUsername: email # field to use as the username for Google OAuth2
github: github:
clientId: '' # Client ID for GitHub OAuth2 clientId: '' # client ID for GitHub OAuth2
clientSecret: '' # Client Secret for GitHub OAuth2 clientSecret: '' # client secret for GitHub OAuth2
scopes: read:user # Scope for GitHub OAuth2 scopes: read:user # scope for GitHub OAuth2
useAsUsername: login # Field to use as the username for GitHub OAuth2 useAsUsername: login # field to use as the username for GitHub OAuth2
issuer: '' # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) end-point issuer: '' # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) endpoint
clientId: '' # Client ID from your provider clientId: '' # client ID from your provider
clientSecret: '' # Client Secret from your provider clientSecret: '' # client secret from your provider
autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
useAsUsername: email # Default is 'email'; custom fields can be used as the username useAsUsername: email # default is 'email'; custom fields can be used as the username
scopes: openid, profile, email # Specify the scopes for which the application will request permissions scopes: openid, profile, email # specify the scopes for which the application will request permissions
provider: google # Set this to your OAuth provider's name, e.g., 'google' or 'keycloak' provider: google # set this to your OAuth provider's name, e.g., 'google' or 'keycloak'
saml2: saml2:
enabled: false # Currently in alpha, not recommended for use yet, enableAlphaFunctionality must be set to true enabled: false # currently in alpha, not recommended for use yet, enableAlphaFunctionality must be set to true
autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
registrationId: stirling registrationId: stirling
@ -56,7 +56,7 @@ security:
idpSingleLogoutUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/slo/saml idpSingleLogoutUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/slo/saml
idpSingleLoginUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/sso/saml idpSingleLoginUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/sso/saml
idpIssuer: http://www.okta.com/externalKey idpIssuer: http://www.okta.com/externalKey
idpCert: classpath:octa.crt idpCert: classpath:okta.crt
privateKey: classpath:saml-private-key.key privateKey: classpath:saml-private-key.key
spCert: classpath:saml-public-cert.crt spCert: classpath:saml-public-cert.crt
@ -65,35 +65,35 @@ enterpriseEdition:
key: 00000000-0000-0000-0000-000000000000 key: 00000000-0000-0000-0000-000000000000
CustomMetadata: CustomMetadata:
autoUpdateMetadata: false # set to 'true' to automatically update metadata with below values autoUpdateMetadata: false # set to 'true' to automatically update metadata with below values
author: username # Supports text such as 'John Doe' or types such as username to autopopulate with users username author: username # supports text such as 'John Doe' or types such as username to autopopulate with user's username
creator: Stirling-PDF # Supports text such as 'Company-PDF' creator: Stirling-PDF # supports text such as 'Company-PDF'
producer: Stirling-PDF # Supports text such as 'Company-PDF' producer: Stirling-PDF # supports text such as 'Company-PDF'
legal: legal:
termsAndConditions: https://www.stirlingpdf.com/terms-and-conditions # URL to the terms and conditions of your application (e.g. https://example.com/terms) Empty string to disable or filename to load from local file in static folder termsAndConditions: https://www.stirlingpdf.com/terms-and-conditions # URL to the terms and conditions of your application (e.g. https://example.com/terms). Empty string to disable or filename to load from local file in static folder
privacyPolicy: https://www.stirlingpdf.com/privacy-policy # URL to the privacy policy of your application (e.g. https://example.com/privacy) Empty string to disable or filename to load from local file in static folder privacyPolicy: https://www.stirlingpdf.com/privacy-policy # URL to the privacy policy of your application (e.g. https://example.com/privacy). Empty string to disable or filename to load from local file in static folder
accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility) Empty string to disable or filename to load from local file in static folder accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility). Empty string to disable or filename to load from local file in static folder
cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie) Empty string to disable or filename to load from local file in static folder cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie). Empty string to disable or filename to load from local file in static folder
impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum) Empty string to disable or filename to load from local file in static folder impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum). Empty string to disable or filename to load from local file in static folder
system: system:
defaultLocale: en-US # Set the default language (e.g. 'de-DE', 'fr-FR', etc) defaultLocale: en-US # set the default language (e.g. 'de-DE', 'fr-FR', etc)
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) enableAlphaFunctionality: false # set to enable functionality which might need more testing before it fully goes live (this feature might make no changes)
showUpdate: false # see when a new update is available showUpdate: false # see when a new update is available
showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true' showUpdateOnlyAdmin: false # only admins can see when a new update is available, depending on showUpdate it must be set to 'true'
customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template HTML files
tessdataDir: /usr/share/tessdata # Path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored. tessdataDir: /usr/share/tessdata # path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored.
enableAnalytics: undefined # Set to 'true' to enable analytics, set to 'false' to disable analytics, for enterprise users this is set to true enableAnalytics: undefined # set to 'true' to enable analytics, set to 'false' to disable analytics; for enterprise users, this is set to true
ui: ui:
appName: '' # Application's visible name appName: '' # application's visible name
homeDescription: '' # Short description or tagline shown on homepage. homeDescription: '' # short description or tagline shown on the homepage
appNameNavbar: '' # Name displayed on the navigation bar appNameNavbar: '' # name displayed on the navigation bar
endpoints: endpoints:
toRemove: [] # List endpoints to disable (e.g. ['img-to-pdf', 'remove-pages']) toRemove: [] # list endpoints to disable (e.g. ['img-to-pdf', 'remove-pages'])
groupsToRemove: [] # List groups to disable (e.g. ['LibreOffice']) groupsToRemove: [] # list groups to disable (e.g. ['LibreOffice'])
metrics: metrics:
enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable