Stirling-PDF/README.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

322 lines
17 KiB
Markdown
Raw Normal View History

2024-04-04 11:16:10 +02:00
<p align="center"><img src="https://raw.githubusercontent.com/Stirling-Tools/Stirling-PDF/main/docs/stirling.png" width="80" ></p>
<h1 align="center">Stirling-PDF</h1>
2023-02-04 16:06:27 +01:00
[![Docker Pulls](https://img.shields.io/docker/pulls/frooodle/s-pdf)](https://hub.docker.com/r/frooodle/s-pdf)
2023-02-12 19:24:13 +01:00
[![Discord](https://img.shields.io/discord/1068636748814483718?label=Discord)](https://discord.gg/Cn8pWhQRxZ)
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/frooodle/s-pdf/latest)](https://github.com/Stirling-Tools/Stirling-PDF/)
[![GitHub Repo stars](https://img.shields.io/github/stars/stirling-tools/stirling-pdf?style=social)](https://github.com/Stirling-Tools/stirling-pdf)
[![Paypal Donate](https://img.shields.io/badge/Paypal%20Donate-yellow?style=flat&logo=paypal)](https://www.paypal.com/paypalme/froodleplex)
[![Github Sponsor](https://img.shields.io/badge/Github%20Sponsor-yellow?style=flat&logo=github)](https://github.com/sponsors/Frooodle)
2023-01-27 19:23:40 +01:00
[![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)
2023-07-29 15:31:09 +02:00
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.
2023-01-30 22:46:38 +01:00
Stirling PDF does not initiate any outbound calls for record-keeping or tracking purposes.
2023-05-17 19:16:39 +02:00
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.
2023-05-17 19:16:39 +02:00
![stirling-home](images/stirling-home.jpg)
2023-09-14 14:35:33 +02:00
## Features
2024-04-04 11:16:10 +02:00
2023-09-14 14:35:33 +02:00
- Dark mode support.
- Custom download options (see [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/images/settings.png) for example)
2023-09-14 14:35:33 +02:00
- Parallel file processing and downloads
2024-01-11 16:35:34 +01:00
- API for integration with external scripts
- Optional Login and Authentication support (see [here](https://github.com/Stirling-Tools/Stirling-PDF/tree/main#login-authentication) for documentation)
2023-09-14 14:35:33 +02:00
2023-09-14 14:32:49 +02:00
## **PDF Features**
### **Page Operations**
2024-04-04 11:16:10 +02:00
2023-10-23 00:14:18 +02:00
- 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)
2024-01-11 16:35:34 +01:00
- Full interactive GUI for merging/splitting/rotating/moving PDFs and their pages.
- Merge multiple PDFs together into a single resultant file.
- Split PDFs into multiple files at specified page numbers or extract all pages as individual files.
- Reorganize PDF pages into different orders.
- Rotate PDFs in 90-degree increments.
- Remove pages.
- Multi-page layout (Format PDFs into a multi-paged page).
- Scale page contents size by set %.
- Adjust Contrast.
- Crop PDF.
- Auto Split PDF (With physically scanned page dividers).
- Extract page(s).
- Convert PDF to a single page.
2023-09-14 14:32:49 +02:00
### **Conversion Operations**
2024-04-04 11:16:10 +02:00
2024-01-11 16:35:34 +01:00
- Convert PDFs to and from images.
- Convert any common file to PDF (using LibreOffice).
- Convert PDF to Word/Powerpoint/Others (using LibreOffice).
- Convert HTML to PDF.
- URL to PDF.
- Markdown to PDF.
2023-09-14 14:32:49 +02:00
### **Security & Permissions**
2024-04-04 11:16:10 +02:00
2024-01-11 16:35:34 +01:00
- Add and remove passwords.
- Change/set PDF Permissions.
- Add watermark(s).
- Certify/sign PDFs.
- Sanitize PDFs.
- Auto-redact text.
2023-09-14 14:32:49 +02:00
### **Other Operations**
2024-04-04 11:16:10 +02:00
2024-01-11 16:35:34 +01:00
- Add/Generate/Write signatures.
- Repair PDFs.
- Detect and remove blank pages.
- Compare 2 PDFs and show differences in text.
- Add images to PDFs.
- Compress PDFs to decrease their filesize (Using OCRMyPDF).
- Extract images from PDF.
- Extract images from Scans.
- Add page numbers.
- Auto rename file by detecting PDF header text.
- OCR on PDF (Using OCRMyPDF).
- PDF/A conversion (Using OCRMyPDF).
- Edit metadata.
- Flatten PDFs.
- Get all information on a PDF to view or export as JSON.
2023-09-14 14:32:49 +02:00
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)
2024-01-11 20:07:56 +01:00
Demo of the app is available [here](https://stirlingpdf.io). username: demo, password: demo
2023-05-06 18:21:02 +02:00
2023-01-27 19:23:40 +01:00
## Technologies used
2024-04-04 11:16:10 +02:00
2023-01-27 19:23:40 +01:00
- Spring Boot + Thymeleaf
2024-01-03 22:28:06 +01:00
- [PDFBox](https://github.com/apache/pdfbox/tree/trunk)
2023-03-28 15:59:40 +02:00
- [LibreOffice](https://www.libreoffice.org/discover/libreoffice/) for advanced conversions
- [OcrMyPdf](https://github.com/ocrmypdf/OCRmyPDF)
2023-01-27 19:23:40 +01:00
- HTML, CSS, JavaScript
- Docker
2024-01-03 22:28:06 +01:00
- [PDF.js](https://github.com/mozilla/pdf.js)
- [PDF-LIB.js](https://github.com/Hopding/pdf-lib)
2023-01-27 19:23:40 +01:00
## How to use
### Locally
2024-04-04 11:16:10 +02:00
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LocalRunGuide.md
2023-01-27 19:23:40 +01:00
### Docker / Podman
2024-04-04 11:16:10 +02:00
2023-01-27 20:10:24 +01:00
https://hub.docker.com/r/frooodle/s-pdf
2024-04-01 19:33:58 +02:00
Stirling PDF has 2 different versions, a Full version and ultra-Lite 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)
2023-08-28 13:49:23 +02:00
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-ultra-lite?label=Stirling-PDF%20Ultra-Lite)
Docker Run
2024-04-04 11:16:10 +02:00
```bash
2023-05-06 17:10:06 +02:00
docker run -d \
-p 8080:8080 \
-v /location/of/trainingData:/usr/share/tessdata \
2023-08-28 13:49:23 +02:00
-v /location/of/extraConfigs:/configs \
2023-12-16 19:18:00 +01:00
-v /location/of/logs:/logs \
2023-09-14 14:32:49 +02:00
-e DOCKER_ENABLE_SECURITY=false \
-e INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false \
-e LANGS=en_GB \
2023-05-06 17:10:06 +02:00
--name stirling-pdf \
frooodle/s-pdf:latest
2024-01-11 16:35:34 +01:00
2023-05-08 23:55:01 +02:00
Can also add these for customisation but are not required
2024-01-11 16:35:34 +01:00
2023-07-04 22:45:35 +02:00
-v /location/of/customFiles:/customFiles \
```
2024-04-04 11:16:10 +02:00
Docker Compose
2024-04-04 11:16:10 +02:00
```yaml
version: '3.3'
services:
2023-05-06 17:10:06 +02:00
stirling-pdf:
image: frooodle/s-pdf:latest
2023-05-06 17:10:06 +02:00
ports:
- '8080:8080'
volumes:
- /location/of/trainingData:/usr/share/tessdata #Required for extra OCR languages
2023-08-28 13:49:23 +02:00
- /location/of/extraConfigs:/configs
2023-07-04 22:45:35 +02:00
# - /location/of/customFiles:/customFiles/
2023-12-16 19:18:00 +01:00
# - /location/of/logs:/logs/
2023-09-14 14:32:49 +02:00
environment:
- DOCKER_ENABLE_SECURITY=false
- INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false
- LANGS=en_GB
```
2023-01-27 19:23:40 +01:00
Note: Podman is CLI-compatible with Docker, so simply replace "docker" with "podman".
2023-04-02 12:51:07 +02:00
2023-03-28 15:59:40 +02:00
## Enable OCR/Compression feature
2024-04-04 11:16:10 +02:00
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToUseOCR.md
2023-03-28 15:59:40 +02:00
## Supported Languages
Stirling PDF currently supports 27!
2024-04-04 11:16:10 +02:00
| Language | Progress |
| ------------------------------------------- | -------------------------------------- |
| English (English) (en_GB) | ![100%](https://geps.dev/progress/100) |
| English (US) (en_US) | ![100%](https://geps.dev/progress/100) |
| Arabic (العربية) (ar_AR) | ![41%](https://geps.dev/progress/41) |
| German (Deutsch) (de_DE) | ![97%](https://geps.dev/progress/97) |
| French (Français) (fr_FR) | ![94%](https://geps.dev/progress/94) |
| Spanish (Español) (es_ES) | ![97%](https://geps.dev/progress/97) |
| Simplified Chinese (简体中文) (zh_CN) | ![96%](https://geps.dev/progress/96) |
| Traditional Chinese (繁體中文) (zh_TW) | ![96%](https://geps.dev/progress/96) |
| Catalan (Català) (ca_CA) | ![50%](https://geps.dev/progress/50) |
| Italian (Italiano) (it_IT) | ![99%](https://geps.dev/progress/99) |
| Swedish (Svenska) (sv_SE) | ![41%](https://geps.dev/progress/41) |
| Polish (Polski) (pl_PL) | ![43%](https://geps.dev/progress/43) |
| Romanian (Română) (ro_RO) | ![40%](https://geps.dev/progress/40) |
| Korean (한국어) (ko_KR) | ![89%](https://geps.dev/progress/89) |
| Portuguese Brazilian (Português) (pt_BR) | ![62%](https://geps.dev/progress/62) |
| Russian (Русский) (ru_RU) | ![89%](https://geps.dev/progress/89) |
| Basque (Euskara) (eu_ES) | ![65%](https://geps.dev/progress/65) |
| Japanese (日本語) (ja_JP) | ![89%](https://geps.dev/progress/89) |
| Dutch (Nederlands) (nl_NL) | ![86%](https://geps.dev/progress/86) |
| Greek (Ελληνικά) (el_GR) | ![87%](https://geps.dev/progress/87) |
| Turkish (Türkçe) (tr_TR) | ![99%](https://geps.dev/progress/99) |
| Indonesia (Bahasa Indonesia) (id_ID) | ![80%](https://geps.dev/progress/80) |
| Hindi (हिंदी) (hi_IN) | ![81%](https://geps.dev/progress/81) |
| Hungarian (Magyar) (hu_HU) | ![79%](https://geps.dev/progress/79) |
| Bulgarian (Български) (bg_BG) | ![96%](https://geps.dev/progress/96) |
| Sebian Latin alphabet (Srpski) (sr_LATN_RS) | ![82%](https://geps.dev/progress/82) |
| Ukrainian (Українська) (uk_UA) | ![88%](https://geps.dev/progress/88) |
| Slovakian (Slovensky) (sk_SK) | ![96%](https://geps.dev/progress/96) |
2024-01-11 16:35:34 +01:00
## Contributing (creating issues, translations, fixing bugs, etc.)
2023-01-27 19:23:40 +01:00
2024-01-11 16:35:34 +01:00
Please see our [Contributing Guide](CONTRIBUTING.md)!
2023-03-28 15:59:40 +02:00
2023-08-28 13:49:23 +02:00
## Customisation
2024-04-04 11:16:10 +02:00
2023-08-28 13:49:23 +02:00
Stirling PDF allows easy customization of the app.
Includes things like
2024-04-04 11:16:10 +02:00
2023-08-28 13:49:23 +02:00
- Custom application name
- Custom slogans, icons, HTML, images CSS etc (via file overrides)
2023-08-28 14:01:16 +02:00
2023-08-28 13:49:23 +02:00
There are two options for this, either using the generated settings file ``settings.yml``
This file is located in the ``/configs`` directory and follows standard YAML formatting
2023-08-28 14:01:16 +02:00
2023-08-28 13:49:23 +02:00
Environment variables are also supported and would override the settings file
For example in the settings.yml you have
2024-04-04 11:16:10 +02:00
```yaml
2023-08-28 13:49:23 +02:00
system:
defaultLocale: 'en-US'
```
2023-08-28 14:01:16 +02:00
2023-08-28 13:49:23 +02:00
To have this via an environment variable you would have ``SYSTEM_DEFAULTLOCALE``
2023-04-03 00:59:22 +02:00
2023-08-28 13:49:23 +02:00
The Current list of settings is
2024-04-04 11:16:10 +02:00
```yaml
2023-08-28 13:49:23 +02:00
security:
2023-08-31 22:24:53 +02:00
enableLogin: false # set to 'true' to enable login
2024-05-19 13:00:46 +02:00
csrfDisabled: true # Set to 'true' to disable CSRF protection (not recommended for production)
loginAttemptCount: 5 # lock user account after 5 tries
loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts
2024-05-19 13:00:46 +02:00
# initialLogin:
# username: "admin" # Initial username for the first login (these are defaulted)
# password: "stirling" # Initial password for the first login
# oauth2:
# enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
# issuer: "" # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) end-point
# clientId: "" # Client ID from your provider
# clientSecret: "" # Client Secret from your provider
# autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users
# 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
# provider: "google" # Set this to your OAuth provider's name, e.g., 'google' or 'keycloak'
2023-08-28 13:49:23 +02:00
system:
defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
2023-09-02 12:30:27 +02:00
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)
showUpdate: true # 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'
customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files
2023-08-28 13:49:23 +02:00
ui:
appName: null # Application's visible name
homeDescription: null # Short description or tagline shown on homepage.
appNameNavbar: null # Name displayed on the navigation bar
2023-08-28 13:49:23 +02:00
endpoints:
2023-08-31 22:24:53 +02:00
toRemove: [] # List endpoints to disable (e.g. ['img-to-pdf', 'remove-pages'])
groupsToRemove: [] # List groups to disable (e.g. ['LibreOffice'])
2023-08-28 13:49:23 +02:00
metrics:
enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable
2023-08-28 13:49:23 +02:00
```
2024-04-04 11:16:10 +02:00
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
2023-08-28 13:49:23 +02:00
### Extra notes
2024-04-04 11:16:10 +02:00
- 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)
2023-08-28 13:49:23 +02:00
- 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
2023-05-18 01:05:53 +02:00
2023-08-31 22:24:53 +02:00
### Environment only parameters
2024-04-04 11:16:10 +02:00
- ``SYSTEM_ROOTURIPATH`` ie set to ``/pdf-app`` to Set the application's root URI to ``localhost:8080/pdf-app``
2023-08-31 22:24:53 +02:00
- ``SYSTEM_CONNECTIONTIMEOUTMINUTES`` to set custom connection timeout values
2023-09-03 02:46:02 +02:00
- ``DOCKER_ENABLE_SECURITY`` to tell docker to download security jar (required as true for auth login)
- ``INSTALL_BOOK_AND_ADVANCED_HTML_OPS`` to download calibre onto stirling-pdf enabling pdf to/from book and advanced html conversion
- ``LANGS`` to define custom font libraries to install for use for document conversions
2023-05-17 19:17:11 +02:00
2023-04-29 00:54:53 +02:00
## API
2024-04-04 11:16:10 +02:00
2023-04-29 00:54:53 +02:00
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
[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)
2023-05-19 00:17:46 +02:00
2023-08-28 13:49:23 +02:00
## Login authentication
2024-04-04 11:16:10 +02:00
2023-10-06 00:53:40 +02:00
![stirling-login](images/login-light.png)
2024-04-04 11:16:10 +02:00
2024-01-11 16:35:34 +01:00
### Prerequisites:
2024-04-04 11:16:10 +02:00
2023-08-17 23:17:42 +02:00
- User must have the folder ./configs volumed within docker so that it is retained during updates.
2024-05-07 11:05:01 +02:00
- Docker users must download the security jar version by setting ``DOCKER_ENABLE_SECURITY`` to ``true`` in environment variables.
2023-09-30 00:58:37 +02:00
- Then either enable login via the settings.yml file or via setting ``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).
2023-08-17 23:17:42 +02:00
2023-08-28 13:49:23 +02:00
Once the above has been done, on restart, a new stirling-pdf-DB.mv.db will show if everything worked.
2023-08-17 23:19:11 +02:00
2023-09-14 12:33:02 +02:00
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
2023-08-17 23:19:11 +02:00
2023-08-28 13:49:23 +02:00
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.
2023-08-17 23:19:11 +02:00
2023-08-28 13:49:23 +02:00
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
2023-08-17 23:19:11 +02:00
2023-08-17 23:17:42 +02:00
For API usage you must provide a header with 'X-API-Key' and the associated API key for that user.
2023-05-19 00:17:46 +02:00
2023-08-17 23:17:42 +02:00
## FAQ
### Q1: What are your planned features?
2024-04-04 11:16:10 +02:00
2023-05-19 00:17:46 +02:00
- Progress bar/Tracking
- Full custom logic pipelines to combine multiple operations together.
- Folder support with auto scanning to perform operations on
2024-01-11 16:35:34 +01:00
- Redact text (Via UI not just automated way)
2023-08-25 00:23:25 +02:00
- Add Forms
2024-01-11 16:35:34 +01:00
- Multi page layout (Stich PDF pages together) support x rows y columns and custom page sizing
- Fill forms manually or automatically
2023-05-19 00:17:46 +02:00
2023-08-17 23:17:42 +02:00
### Q2: Why is my application downloading .htm files?
2024-04-04 11:16:10 +02:00
2023-12-28 16:34:56 +01:00
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.
2023-09-30 00:58:37 +02:00
### Q3: Why is my download timing out
2024-04-04 11:16:10 +02:00
2023-10-06 00:53:40 +02:00
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;``