Stirling-PDF/src/main/java/stirling/software/SPDF/controller/api
Abdur Rahman 41b41996c5
fix(pdf): resolve compression error and file overwrite issues (#2937)
# Description of Changes

- **What was changed:**
- Modified the file handling logic to avoid overwriting the source PDF
while it is being read, which previously led to corrupted output files.
-Modified the logic where optimizeLevel is 9 and we are chacking for
optimizeLevel < 9.
- **Why the change was made:**
- The original compression process would stuck when dealing with larger
files, failing to meet the specified target size limits.
- Overwriting the input file during processing was causing warnings and
potential file corruption, which could lead to instability and incorrect
outputs.

- **Any challenges encountered:**

Closes #2930

---

## 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/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/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/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] 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
2025-02-12 22:15:30 +00:00
..
converters PDFA fixes (#2896) 2025-02-07 13:06:19 +00:00
filters fix: use the same margins for x and y in the stamp feature 2024-02-07 21:40:33 -05:00
misc fix(pdf): resolve compression error and file overwrite issues (#2937) 2025-02-12 22:15:30 +00:00
pipeline pipeline bug, doc bugs, auto split new URL and doc (#2906) 2025-02-07 13:17:35 +00:00
security pipeline bug, doc bugs, auto split new URL and doc (#2906) 2025-02-07 13:17:35 +00:00
AdditionalLanguageJsController.java Update sonarqube.yml and removal of gradle keys (#2866) 2025-02-04 10:18:02 +00:00
AnalysisController.java Posthog to log to log file (#2813) 2025-01-30 15:13:42 +00:00
CropController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
DatabaseController.java Add Conditional Handling for H2SQL Databases and Improve Database Compatibility (#2632) 2025-01-08 10:22:45 +00:00
H2SQLCondition.java Add Conditional Handling for H2SQL Databases and Improve Database Compatibility (#2632) 2025-01-08 10:22:45 +00:00
MergeController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
MultiPageLayoutController.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
PdfImageRemovalController.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
PdfOverlayController.java Metadata handling for all PDF endpoints (#1894) 2024-09-14 16:29:39 +01:00
RearrangePagesPDFController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
RotationController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
ScalePagesController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
SettingsController.java File paths dynamic (#2605) 2025-01-06 12:41:30 +00:00
SplitPdfByChaptersController.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
SplitPdfBySectionsController.java Fix issue #2511: Fix broken ZIP issue by adding zipOut.finish() (#2890) 2025-02-07 13:36:33 +00:00
SplitPdfBySizeController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
SplitPDFController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
ToSinglePageController.java Remove Direct Logger and Use Lombok @Slf4j 2024-12-17 10:26:18 +01:00
UserController.java #2270: External DB Support (#2457) 2025-01-06 18:58:26 +00:00