This commit is contained in:
Anthony Stirling 2023-09-14 13:32:49 +01:00
parent fc4feb2096
commit f6c4f08254
6 changed files with 93 additions and 41 deletions

View file

@ -8,7 +8,7 @@ Fork Stirling-PDF and make 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 reference to the language in the navbar by adding a new language entry to the dropdown
https://github.com/Frooodle/Stirling-PDF/blob/main/src/main/resources/templates/fragments/navbar.html#L306 https://github.com/Frooodle/Stirling-PDF/blob/main/src/main/resources/templates/fragments/languages.html
and add a flag svg file to and add a flag svg file to
https://github.com/Frooodle/Stirling-PDF/tree/main/src/main/resources/static/images/flags https://github.com/Frooodle/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/) Any SVG flags are fine, i got most of mine from [here](https://flagicons.lipis.dev/)
@ -25,7 +25,7 @@ The data-language-code is the code used to reference the file in the next step.
Start by copying the existing english property file Start by copying the existing english property file
[https://github.com/Frooodle/Stirling-PDF/tree/langSetup/src/main/resources/messages_en_GB.properties](https://github.com/Frooodle/Stirling-PDF/blob/main/src/main/resources/messages_en_US.properties) [https://github.com/Frooodle/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties](https://github.com/Frooodle/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)
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 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

View file

@ -21,45 +21,64 @@ Feel free to request any features or bug fixes either in github issues or our [D
![stirling-home](images/stirling-home.png) ![stirling-home](images/stirling-home.png)
## **PDF Features**
## Features ### **Page Operations**
- 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.
- 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.
- Merge multiple PDFs together into a single resultant file
- Convert PDFs to and from images
- Reorganize PDF pages into different orders. - Reorganize PDF pages into different orders.
- Add/Generate signatures - Rotate PDFs in 90-degree increments.
- Format PDFs into a multi-paged page - Remove pages.
- Scale page contents size by set % - Multi-page layout (Format PDFs into a multi-paged page).
- Adjust Contrast - Scale page contents size by set %.
- Crop PDF - Adjust Contrast.
- Auto Split PDF (With physically scanned page dividers) - Crop PDF.
- Flatten PDFs - Auto Split PDF (With physically scanned page dividers).
- Repair PDFs - Extract page(s).
- Detect and remove blank pages - Convert PDF to a single page.
- Compare 2 PDFs and show differences in text
- Add images to PDFs ### **Conversion Operations**
- Rotating PDFs in 90 degree increments. - Convert PDFs to and from images.
- Compressing PDFs to decrease their filesize. (Using OCRMyPDF) - Convert any common file to PDF (using LibreOffice).
- Add and remove passwords - Convert PDF to Word/Powerpoint/Others (using LibreOffice).
- Set PDF Permissions - Convert HTML to PDF.
- Add watermark(s) - URL to PDF.
- Convert Any common file to PDF (using LibreOffice) - Markdown to PDF.
- Convert PDF to Word/Powerpoint/Others (using LibreOffice)
- Convert HTML to PDF ### **Security & Permissions**
- URL to PDF - Add and remove passwords.
- Extract images from PDF - Change/set PDF Permissions.
- Extract images from Scans - Add watermark(s).
- Add page numbers - Certify/sign PDFs.
- Auto rename file by detecting PDF header text - Sanitize PDFs.
- OCR on PDF (Using OCRMyPDF) - Auto-redact text.
- PDF/A conversion (Using OCRMyPDF)
- Edit metadata ### **Other Operations**
- 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.
## Extra Features
- Dark mode support. - Dark mode support.
- Custom download options (see [here](https://github.com/Frooodle/Stirling-PDF/blob/main/images/settings.png) for example) - Custom download options (see [here](https://github.com/Frooodle/Stirling-PDF/blob/main/images/settings.png) for example)
- Parallel file processing and downloads - Parallel file processing and downloads
- API for integration with external scripts - API for integration with external scripts
For a overview of the tasks and the technology each uses please view [groups.md](https://github.com/Frooodle/Stirling-PDF/blob/main/Groups.md) For a overview of the tasks and the technology each uses please view [groups.md](https://github.com/Frooodle/Stirling-PDF/blob/main/Groups.md)
Hosted instance/demo of the app can be seen [here](https://pdf.adminforge.de/) hosted by the team at adminforge.de Hosted instance/demo of the app can be seen [here](https://pdf.adminforge.de/) hosted by the team at adminforge.de
@ -94,6 +113,7 @@ docker run -d \
-p 8080:8080 \ -p 8080:8080 \
-v /location/of/trainingData:/usr/share/tesseract-ocr/4.00/tessdata \ -v /location/of/trainingData:/usr/share/tesseract-ocr/4.00/tessdata \
-v /location/of/extraConfigs:/configs \ -v /location/of/extraConfigs:/configs \
-e DOCKER_ENABLE_SECURITY=false \
--name stirling-pdf \ --name stirling-pdf \
frooodle/s-pdf:latest frooodle/s-pdf:latest
@ -114,6 +134,11 @@ services:
- /location/of/trainingData:/usr/share/tesseract-ocr/4.00/tessdata #Required for extra OCR languages - /location/of/trainingData:/usr/share/tesseract-ocr/4.00/tessdata #Required for extra OCR languages
- /location/of/extraConfigs:/configs - /location/of/extraConfigs:/configs
# - /location/of/customFiles:/customFiles/ # - /location/of/customFiles:/customFiles/
environment:
- DOCKER_ENABLE_SECURITY=false
``` ```
@ -122,8 +147,9 @@ services:
Please view https://github.com/Frooodle/Stirling-PDF/blob/main/HowToUseOCR.md Please view https://github.com/Frooodle/Stirling-PDF/blob/main/HowToUseOCR.md
## Want to add your own language? ## Want to add your own language?
Stirling PDF currently supports 16! Stirling PDF currently supports 18!
- English (English) (en_GB) - English (English) (en_GB)
- English (US) (en_US)
- Arabic (العربية) (ar_AR) - Arabic (العربية) (ar_AR)
- German (Deutsch) (de_DE) - German (Deutsch) (de_DE)
- French (Français) (fr_FR) - French (Français) (fr_FR)
@ -139,6 +165,7 @@ Stirling PDF currently supports 16!
- Russian (Русский) (ru_RU) - Russian (Русский) (ru_RU)
- Basque (Euskara) (eu_ES) - Basque (Euskara) (eu_ES)
- Japanese (日本語) (ja_JP) - Japanese (日本語) (ja_JP)
- Dutch (Nederlands) (nl_NL)
If you want to add your own language to Stirling-PDF please refer If you want to add your own language to Stirling-PDF please refer
https://github.com/Frooodle/Stirling-PDF/blob/main/HowToAddNewLanguage.md https://github.com/Frooodle/Stirling-PDF/blob/main/HowToAddNewLanguage.md
@ -190,7 +217,7 @@ endpoints:
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 endpoints (view http://localhost:8080/swagger-ui/index.html#/API to learn more), 'false' to disable
``` ```
### 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/Frooodle/Stirling-PDF/blob/main/groups.md) - 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/Frooodle/Stirling-PDF/blob/main/groups.md)

View file

@ -22,7 +22,6 @@ public class CleanUrlInterceptor implements HandlerInterceptor {
String queryString = request.getQueryString(); String queryString = request.getQueryString();
if (queryString != null && !queryString.isEmpty()) { if (queryString != null && !queryString.isEmpty()) {
String requestURI = request.getRequestURI(); String requestURI = request.getRequestURI();
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
// Keep only the allowed parameters // Keep only the allowed parameters

View file

@ -37,3 +37,11 @@ spring.datasource.username=sa
spring.datasource.password= spring.datasource.password=
spring.h2.console.enabled=true spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
# Change the default URL path for OpenAPI JSON
springdoc.api-docs.path=/v1/api-docs
# Set the URL of the OpenAPI JSON for the Swagger UI
springdoc.swagger-ui.url=/v1/api-docs

View file

@ -175,7 +175,7 @@
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector('form[action="/change-password"]'); const form = document.querySelector('form[action="api/v1/user/change-password"]');
form.addEventListener('submit', function(event) { form.addEventListener('submit', function(event) {
const newPassword = document.getElementById('newPassword').value; const newPassword = document.getElementById('newPassword').value;

View file

@ -37,7 +37,7 @@
<!-- Change Username Form --> <!-- Change Username Form -->
<h4></h4> <h4></h4>
<h4 th:text="#{changeCreds.changeUserAndPassword}">Change Username and password</h4> <h4 th:text="#{changeCreds.changeUserAndPassword}">Change Username and password</h4>
<form action="/api/v1/user/change-username-and-password" method="post"> <form action="api/v1/user/change-username-and-password" method="post">
<div class="mb-3"> <div class="mb-3">
<label for="newUsername" th:text="#{changeCreds.newUsername}">New Username</label> <label for="newUsername" th:text="#{changeCreds.newUsername}">New Username</label>
<input type="text" class="form-control" name="newUsername" id="newUsername" th:placeholder="${username}"> <input type="text" class="form-control" name="newUsername" id="newUsername" th:placeholder="${username}">
@ -50,12 +50,30 @@
<label for="newPassword" th:text="#{changeCreds.newPassword}">New Password</label> <label for="newPassword" th:text="#{changeCreds.newPassword}">New Password</label>
<input type="password" class="form-control" name="newPassword" id="newPassword" th:placeholder="#{changeCreds.newPassword}"> <input type="password" class="form-control" name="newPassword" id="newPassword" th:placeholder="#{changeCreds.newPassword}">
</div> </div>
<div class="mb-3">
<label for="confirmNewPassword" th:text="#{account.confirmNewPassword}">Confirm New Password</label>
<input type="password" class="form-control" name="confirmNewPassword" id="confirmNewPassword" th:placeholder="#{account.confirmNewPassword}">
</div>
<div class="mb-3"> <div class="mb-3">
<button type="submit" class="btn btn-primary" th:text="#{changeCreds.submit}">Change credentials!</button> <button type="submit" class="btn btn-primary" th:text="#{changeCreds.submit}">Change credentials!</button>
</div> </div>
</form> </form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector('form[action="api/v1/user/change-username-and-password"]');
form.addEventListener('submit', function(event) {
const newPassword = document.getElementById('newPassword').value;
const confirmNewPassword = document.getElementById('confirmNewPassword').value;
if (newPassword !== confirmNewPassword) {
alert('New Password and Confirm New Password must match.');
event.preventDefault(); // Prevent form submission
}
});
});
</script>
</div> </div>