mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-17 13:52:14 +01:00
feat(compress): expose linearize PDF option on the UI (#4843)
# Description of Changes TLDR: - Added a new checkbox in the UI for linearizing PDFs - Updated `CompressController` to support PDF linearization - Added new localization key for linearize option in messages properties file <img width="604" height="858" alt="image" src="https://github.com/user-attachments/assets/3e7fb3c1-247d-45b1-b00b-fd19a9888d28" /> <!-- 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) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### 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>
This commit is contained in:
@@ -774,11 +774,11 @@ public class CompressController {
|
||||
this.streamLength = image.getCOSObject().getLength();
|
||||
this.imageType = getImageType(image);
|
||||
this.decodeParams = generateDecodeParamsHash(image);
|
||||
this.metadataHash = this.generateMetadataHash(image);
|
||||
this.metadataHash = ImageIdentity.generateMetadataHash(image);
|
||||
}
|
||||
|
||||
// Generate hash of image metadata
|
||||
private String generateMetadataHash(PDImageXObject image) {
|
||||
private static String generateMetadataHash(PDImageXObject image) {
|
||||
try {
|
||||
StringBuilder metadata = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1329,6 +1329,7 @@ compress.title=Compress
|
||||
compress.header=Compress PDF
|
||||
compress.credit=This service uses qpdf for PDF Compress/Optimisation.
|
||||
compress.grayscale.label=Apply Grayscale for Compression
|
||||
compress.linearize.label=Linearize PDF for faster web viewing
|
||||
compress.selectText.1=Compression Settings
|
||||
compress.selectText.1.1=1-3 PDF compression,</br> 4-6 lite image compression,</br> 7-9 intense image compression Will dramatically reduce image quality
|
||||
compress.selectText.2=Optimisation level:
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
<label for="grayscaleCheck" th:text="#{compress.grayscale.label}">
|
||||
Convert images to grayscale for better compression
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check mt-3">
|
||||
<input id="linearizeCheck" name="linearize" type="checkbox" value="true">
|
||||
<label for="linearizeCheck" th:text="#{compress.linearize.label}">
|
||||
Linearize PDF for faster web viewing
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user