Stirling-PDF/testing
Balázs Szücs 085b8795d5
feat(crop): Crop remove outside text (#4499)
# Description of Changes

This PR adds option to remove text outside crop area via Ghostscript.
### Crop feature enhancements

- Added a checkbox to the `crop.html` template and a corresponding label
in the English properties file to allow users to select "Remove text
outside crop (retains images)" when cropping PDFs.
- Updated the `CropPdfForm` model to include a new boolean property
`removeDataOutsideCrop` to capture the user's selection.
<img width="1418" height="815" alt="image"
src="https://github.com/user-attachments/assets/47785372-7609-4637-ab3b-f05ab6d95957"
/>


### Backend logic changes

- Modified the `CropController` so that if `removeDataOutsideCrop` is
true, cropping is performed using a two-step process: first setting the
crop box with PDFBox, then using Ghostscript to remove data outside the
crop box. Otherwise, the crop is performed using only PDFBox.
- Added necessary imports for handling files, paths, and process
execution to support the new Ghostscript-based cropping workflow.

### Endpoint configuration

- Registered the new "crop" endpoint under the "Ghostscript" group in
the endpoint configuration, enabling routing for the enhanced cropping
feature.

### UI
<img width="671" height="867" alt="image"
src="https://github.com/user-attachments/assets/ad01fcd4-343b-40e8-9345-135bdf746ca4"
/>

### Sample files/Verification
Before:
<img width="969" height="747" alt="image"
src="https://github.com/user-attachments/assets/d5a205f7-0aaf-4990-9b24-43e9ef9cf716"
/>

After:
<img width="1165" height="690" alt="image"
src="https://github.com/user-attachments/assets/7c73e35b-c52b-4be2-a892-72f0125f66b4"
/>

See for yourself with:

[true-pdf-sample-1_cropped.pdf](https://github.com/user-attachments/files/22546716/true-pdf-sample-1_cropped.pdf)
other sample PDF:

[output.pdf](https://github.com/user-attachments/files/22546785/output.pdf)

Closes #2652

<!--
Please provide a summary of the changes, including:

- What was changed
- Why the change was made
- Any challenges encountered

Closes #(issue_number)
-->

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [x] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
2025-10-11 18:35:24 +01:00
..
cucumber fix(ci): 🛡️ mitigate CVE-2025-8869 by enforcing wheels-only pip installs and upgrading pinned dependencies (#4598) 2025-10-04 12:50:37 +01:00
testdriver Test cleanup, JVM GC and api (#2787) 2025-01-26 13:10:16 +00:00
allEndpointsRemovedSettings.yml Defaulting JWT settings to false (#4416) 2025-09-30 12:02:11 +01:00
endpoints.txt Add Attachments Feature (#3781) 2025-06-24 23:52:17 +01:00
test2.sh Test cleanup, JVM GC and api (#2787) 2025-01-26 13:10:16 +00:00
test_disabledEndpoints.sh Pipeline shows disabled endpoints fix (#2881) (#3282) 2025-04-09 11:03:40 +01:00
test_webpages.sh Upgrade Gradle to 8.14 in CI Workflows and Gradle Wrapper (#3425) 2025-04-27 16:17:07 +01:00
test.sh refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
webpage_urls_full.txt Security fixes, enterprise stuff and more (#3241) 2025-03-25 17:57:17 +00:00
webpage_urls.txt feat(crop): Crop remove outside text (#4499) 2025-10-11 18:35:24 +01:00