Commit Graph
644 Commits
Author SHA1 Message Date
b8303e3860 Pdf to image custom page selection (#2576)
# Description

Implemented custom page selection for the pdf-to-image feature, allowing
users to specify which PDF pages to convert to images.

1. Variable Renaming: Changed singleOrMultiple to imageResultType
because it supports three options: single, multiple, and custom.
2. New Field: Added pageNumbers to accept user-defined page selections.
This field appears only when custom is selected in the UI.
3. New Method: Added getPageIndicesToConvert to process and validate the
specified page numbers.
4. Method Update: Updated convertFromPdf to handle custom page numbers,
ensuring only selected pages are converted.
5. Translation Properties: Added two new English translation properties,
custom and customPageNumber, to all language files with placeholder
values. These will need to be translated into country-specific languages
in the future.

Note: If an invalid page number is provided (zero, negative, or exceeds
page count), a single image containing all PDF pages is generated.

Closes #918 

## Checklist

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have performed a self-review of my own code
- [x] I have attached images of the change if it is UI based
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] If my code has heavily changed functionality I have updated
relevant docs on [Stirling-PDFs doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
- [x] My changes generate no new warnings
- [x] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

![Screenshot 2025-01-02 at 12 31
29 AM](https://github.com/user-attachments/assets/c4ba3f31-5dd6-4a17-991e-51b86c2eb466)
![Screenshot 2025-01-02 at 12 31
49 AM](https://github.com/user-attachments/assets/3e800a95-2088-4f69-8a01-bd03d7b9e471)

---------

Co-authored-by: Sai Kumar J <[email protected]>
Co-authored-by: Ludy <[email protected]>
Co-authored-by: saikumar <[email protected]>
Co-authored-by: Anthony Stirling <[email protected]>
2025-01-04 18:01:13 +00:00
LudyandGitHub f45de05c99 Fixes SSO login rejection (#2566)
# Description

## Checklist

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have performed a self-review of my own code
- [ ] I have attached images of the change if it is UI based
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] If my code has heavily changed functionality I have updated
relevant docs on [Stirling-PDFs doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
- [x] My changes generate no new warnings
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
2025-01-02 14:52:07 +00:00
Omar Ahmed HassanandGitHub d5faddbc85 Enhancement: Enhance NFunction evaluation and support advanced NFunctions (#2577)
# Description

Enhance NFunction sanitization and support advanced functions:
- Start page counting from 1 rather than 0 as PDFs are one based from
the user's perspective, thus functions results would be affected by
starting with "0" rather than "1".
- Ignore out of bound results rather than stopping iterations to work
with functions such as (n - 4) when page count is 10 as we would get
positive values when n > 4.
- Remove spaces to support expressions such as 2n + 1 rather just 2n+1.
- Support advanced functions as follows:
- Support expressions such as follows 5(n-1), n(n-1), expressions
followed by opening rounded without '*' operator.
- Support expressions such as follows (n-1)5, (n-1)n, expressions
preceded closing rounded without '*' operator.
- Support consecutive "n" expressions, examples: nnn, 2nn, nn*3, nnnn.

Closes #(issue_number)

## Checklist

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have performed a self-review of my own code
- [ ] I have attached images of the change if it is UI based
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] If my code has heavily changed functionality I have updated
relevant docs on [Stirling-PDFs doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
- [x] My changes generate no new warnings
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
2025-01-02 14:48:20 +00:00
Anthony StirlingandGitHub 9884c65b10 formattingand autowired constructors (#2557)
# Description
This pull request includes several changes aimed at improving the code
structure and removing redundant code. The most significant changes
involve reordering methods, removing unnecessary annotations, and
refactoring constructors to use dependency injection.
Autowired now comes via constructor (which also doesn't need autowired
annotation as its done by default for configuration)



## Checklist

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have performed a self-review of my own code
- [ ] I have attached images of the change if it is UI based
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] If my code has heavily changed functionality I have updated
relevant docs on [Stirling-PDFs doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
- [ ] My changes generate no new warnings
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
2024-12-24 09:52:53 +00:00
Anthony Stirling 2a1dad80f0 rename 2024-12-22 11:17:22 +00:00
Omar Ahmed Hassan 167c792bf0 Draw image with the original PDF page dimensions 2024-12-19 13:34:13 +02:00
Anthony Stirling 6ce761aff2 Merge remote-tracking branch 'origin/main' into configCheck 2024-12-18 18:05:16 +00:00
Anthony Stirling 8a5d9f9a95 mounted_config_dir 2024-12-18 18:04:10 +00:00
Ludy87 a531f53893 Exclude Sensitive and Error-Prone Fields from toString() in SAML2 Configuration 2024-12-18 13:40:24 +01:00
reecebrowneandGitHub a72615cc86 Merge branch 'main' into bug/2490/2488/image-to-pdf 2024-12-18 10:40:54 +00:00
Reece Browne 9eed761346 Correct default fit 2024-12-18 00:36:04 +00:00
Reece Browne 12d86049f6 Add default to convert image to pdf api 2024-12-18 00:30:06 +00:00
Ludy87 051cd2d0d5 Adds manual backup creation 2024-12-17 23:23:16 +01:00
Ludy87 af100d4190 Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
Anthony StirlingandGitHub 30ee33002d Merge branch 'main' into testStuff 2024-12-13 19:31:53 +00:00
Anthony Stirling 509a305985 logs and cleanup 2024-12-13 16:58:34 +00:00
Anthony Stirling 43c4ec1089 fixes! 2024-12-13 11:31:49 +00:00
Anthony StirlingandGitHub c6980e9693 Merge pull request #2434 from Ludy87/security_fix_1
Security fix: Server-Side Request Forgery
2024-12-12 11:28:56 +00:00
Anthony Stirling 1c5dfc46a0 fixes 2024-12-11 23:13:23 +00:00
Anthony Stirling c20d37518d prop fixes 2024-12-11 22:09:35 +00:00
Anthony Stirling eb20f51958 headless 2024-12-11 21:56:50 +00:00
Anthony Stirling 97d28ac6d2 Windows UI .exe 2024-12-11 21:54:05 +00:00
Anthony StirlingandGitHub 026fe8150d Merge pull request #2427 from Stirling-Tools/testStuff
X-API-key to X-API-KEY and enable CSRF protection for all users
2024-12-11 21:52:57 +00:00
Ludy87 c3f88f716c Update GeneralUtils.java 2024-12-11 21:10:18 +01:00
Ludy87 67f983f00d Security fix: Server-Side Request Forgery
https://github.com/Stirling-Tools/Stirling-PDF/security/advisories/GHSA-4v4c-9hpr-93vx
2024-12-11 21:06:07 +01:00
Anthony StirlingandGitHub 82bebf5c62 Merge branch 'main' into feature/1856/decrypt 2024-12-11 17:26:14 +00:00
Anthony Stirling 58c7d7b9a8 X-API-key to X-API-KEY 2024-12-10 20:39:24 +00:00
Anthony Stirling c1c3eba398 ensure csrf is enabled 2024-12-10 11:17:50 +00:00
Anthony Stirling 1639e0fc4c format 2024-12-09 20:41:13 +00:00
Anthony Stirling 0652299bec fixes 2024-12-09 20:40:59 +00:00
Sai KumarandGitHub b47df3d252 Text color selection for watermark (#2415)
* added custom color selection for Watermark

* using the same translation as AddStampRequest.customColor for the new watermark.customColor

* fixed the space issue between words
2024-12-07 14:19:50 +00:00
Reece Browne dcafc0d487 Merge branch 'decrypt' of https://github.com/Stirling-Tools/Stirling-PDF 2024-12-06 15:33:44 +00:00
Anthony StirlingandGitHub 5a5a8bb7ba quick fixes (#2404) 2024-12-05 19:55:34 +00:00
Omar Ahmed HassanandGitHub f8f137a30a Feature: Show permissions as a separate tab (#2396)
Show permissions as a separate tab

- Move permissions code into a separate for better readability and maintainability.
- Separate `Permissions` node from `Encryption` so that it would be displayed in the frontend as a separate tab.
- Use more user friendly permission labels such as replacing `canModify` with `Modifying` and values such as `Allowed` and `Not Allowed` instead of `true`, `false`.
- Show permissions regardless of the encryption state.
2024-12-05 17:00:23 +00:00
Anthony StirlingGitHubpixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>a <a>
cce9f74eb9 PDF Cert validation (#2394)
* verifyCerts

* cert info

* Hardening suggestions for Stirling-PDF / certValidate (#2395)

* Protect `readLine()` against DoS

* Switch order of literals to prevent NullPointerException

---------

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>

* some basic html excaping and translation fixing

---------

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
Co-authored-by: a <a>
2024-12-05 15:56:22 +00:00
Anthony StirlingandGitHub 99d1b46d97 Update MetricsAggregatorService.java 2024-12-03 15:26:40 +00:00
Omar Ahmed HassanandGitHub b7da84d257 Fix deserialization failure in Change Metadata (#2382)
* Fix deserialization failure from String to Map

Fix deserialization failure from String to Map that caused the following exception:
Resolved [org.springframework.web.bind.MethodArgumentNotValidException: Validation failed for argument [0] in public org.springframework.http.ResponseEntity<byte[]> stirling.software.SPDF.controller.api.misc.MetadataController.metadata(stirling.software.SPDF.model.api.misc.MetadataRequest) throws java.io.IOException: [Field error in object 'metadataRequest' on field 'allRequestParams': rejected value [{"customKey1" : "YourCustomKey", "customKeyValue1", "YourCustomValue"}]; codes [typeMismatch.metadataRequest.allRequestParams,typeMismatch.allRequestParams,typeMismatch.java.util.Map,typeMismatch];

* Fix form binding for dynamic Map entries in Change Metadata

- Implemented support for dynamic key-value inputs in Change Metadata form using proper `name` attributes for Map (`allRequestParams`) binding.
- Fix form binding for dynamic Map (`allRequestParams`) entries in Change Metadata as the `allRequestParams` (Map name) was being sent as an empty map.
2024-12-03 08:28:34 +00:00
3c0a8071dc added support for new line break in stampController (#2370)
added support for new line in stampController

Co-authored-by: Anthony Stirling <[email protected]>
2024-12-02 17:48:19 +00:00
Anthony StirlingandGitHub 3633a979d3 fixes and other changes and debug of WIP SAML (#2360)
* backup

* remove debugs

* oauth to saml and compare fixes etc

* ee flag for saml

* more fixes

* info to debug

* remove unused repo

* spring dev fix for saml

* debugs

* saml stuff

* debugs

* fix
2024-11-29 15:11:59 +00:00
pixeebot[bot]GitHubpixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
d832a90de0 (CodeQL) Fixed finding: "Arbitrary file access during archive extraction ("Zip Slip")
" (#2344)

(CodeQL) Fixed finding: "Arbitrary file access during archive extraction ("Zip Slip")
"

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2024-11-27 07:16:03 +00:00
Anthony StirlingandGitHub 212e521238 Update MetricsAggregatorService.java 2024-11-26 21:30:47 +00:00
Anthony StirlingGitHubpixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
833b3c45c6 Removal of Ghostscript to use qpdf and tesseract directly (#2338)
* navbar fix multi tool and compress location

* release notes and ghostscript removal

* cleanups

* formatting

* update docs

* more

* more

* docs

* release bump

* Hardening suggestions for Stirling-PDF / ghostscript (#2339)

* Protect `readLine()` against DoS

* Sanitized user-provided file names in HTTP multipart uploads

---------

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>

---------

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
2024-11-26 20:50:35 +00:00
Anthony Stirling 5936e856f0 metrics 2024-11-25 14:02:17 +00:00
LudyandGitHub 8f4709d82e Bump com.h2database:h2 from 2.1.214 to 2.3.232 (#2314) 2024-11-24 14:36:53 +00:00
Omar Ahmed HassanandGitHub afad06bed4 Extract tables from PDF to CSV using Tabula (#2312)
* Add Tabula dependency and exclude slf4j-simple

- Add tabula-java dependency to extract tables into CSV.
- Exclude slf4j-simple due to Logback

* Add a flexible CSVWriter

- Add FlexibleCSVWriter which extends CSVWriter to pass a custom CSVFormat, as CSVWriter's parameterized constructor (that allows changing CSVFormat) is protected.

* Use Tabula in extracting tables from PDF

- Use Tabula in extracting tables from PDF instead of the existing implementation

* Delete PDFTableStripper as It is unneeded

- Delete PDFTableStripper as It is unneeded as Tabula-Java is used instead.

* Use correct class in ExtractCSVController logger

* Exclude gson and bcprov-jdk15on dependencies from tabula

- Exclude gson and bcprov-jdk15on from tabula-java due to detected security vulnerabilities.
2024-11-23 23:28:44 +00:00
LudyandGitHub 9abb105835 Fix: Fixes dependency bug and replaces obsolete method (#2309) 2024-11-23 10:51:17 +00:00
reecebrowneGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
0e602153f3 Feature/2198/multitool multi select move pages (#2294)
* Multitool - Select multiple pages for rotation tool

* Multitool multi select delete feature

* Multitool multi select UI improvements and big fixes

* Multitool multi select select all and UI improvements

* Multi tool multi select, download selected, clean up and bug fixes

* Groundwork for multiselect drag and drop

* Multi select drag and drop finalised

* Update translation files

Signed-off-by: GitHub Action <[email protected]>

* Turn off select mode after multidrag

---------

Signed-off-by: GitHub Action <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-22 11:39:22 +00:00
Anthony StirlingandGitHub 6c623d8d84 Update MetricsAggregatorService.java (#2272) 2024-11-20 08:20:01 +00:00
5e1aac0b84 Read login data from application.properties (#2263)
Co-authored-by: Anthony Stirling <[email protected]>
2024-11-17 14:08:41 +00:00
LudyandGitHub d3ae9f9a81 Prohibit the registration of unauthorized usernames (#2240) 2024-11-15 09:36:59 +00:00