mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-04-06 03:19:39 +02:00
JUnits JUnits JUnits, so many JUnits (#3537)
# Description of Changes Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] 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) - [ ] I have performed a self-review of my own code - [ ] 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) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -61,6 +61,7 @@ public class EEAppConfig {
|
||||
}
|
||||
|
||||
// TODO: Remove post migration
|
||||
@SuppressWarnings("deprecation")
|
||||
public void migrateEnterpriseSettingsToPremium(ApplicationProperties applicationProperties) {
|
||||
EnterpriseEdition enterpriseEdition = applicationProperties.getEnterpriseEdition();
|
||||
Premium premium = applicationProperties.getPremium();
|
||||
|
||||
@@ -47,7 +47,8 @@ public class ConvertMarkdownToPdf {
|
||||
description =
|
||||
"This endpoint takes a Markdown file input, converts it to HTML, and then to"
|
||||
+ " PDF format. Input:MARKDOWN Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> markdownToPdf(@ModelAttribute GeneralFile generalFile) throws Exception {
|
||||
public ResponseEntity<byte[]> markdownToPdf(@ModelAttribute GeneralFile generalFile)
|
||||
throws Exception {
|
||||
MultipartFile fileInput = generalFile.getFileInput();
|
||||
|
||||
if (fileInput == null) {
|
||||
|
||||
@@ -626,32 +626,32 @@ public class CompressController {
|
||||
|
||||
// Scale factors for different optimization levels
|
||||
private double getScaleFactorForLevel(int optimizeLevel) {
|
||||
return switch (optimizeLevel) {
|
||||
case 3 -> 0.85;
|
||||
case 4 -> 0.75;
|
||||
case 5 -> 0.65;
|
||||
case 6 -> 0.55;
|
||||
case 7 -> 0.45;
|
||||
case 8 -> 0.35;
|
||||
case 9 -> 0.25;
|
||||
case 10 -> 0.15;
|
||||
default -> 1.0;
|
||||
};
|
||||
return switch (optimizeLevel) {
|
||||
case 3 -> 0.85;
|
||||
case 4 -> 0.75;
|
||||
case 5 -> 0.65;
|
||||
case 6 -> 0.55;
|
||||
case 7 -> 0.45;
|
||||
case 8 -> 0.35;
|
||||
case 9 -> 0.25;
|
||||
case 10 -> 0.15;
|
||||
default -> 1.0;
|
||||
};
|
||||
}
|
||||
|
||||
// JPEG quality for different optimization levels
|
||||
private float getJpegQualityForLevel(int optimizeLevel) {
|
||||
return switch (optimizeLevel) {
|
||||
case 3 -> 0.85f;
|
||||
case 4 -> 0.80f;
|
||||
case 5 -> 0.75f;
|
||||
case 6 -> 0.70f;
|
||||
case 7 -> 0.60f;
|
||||
case 8 -> 0.50f;
|
||||
case 9 -> 0.35f;
|
||||
case 10 -> 0.2f;
|
||||
default -> 0.7f;
|
||||
};
|
||||
return switch (optimizeLevel) {
|
||||
case 3 -> 0.85f;
|
||||
case 4 -> 0.80f;
|
||||
case 5 -> 0.75f;
|
||||
case 6 -> 0.70f;
|
||||
case 7 -> 0.60f;
|
||||
case 8 -> 0.50f;
|
||||
case 9 -> 0.35f;
|
||||
case 10 -> 0.2f;
|
||||
default -> 0.7f;
|
||||
};
|
||||
}
|
||||
|
||||
@PostMapping(consumes = "multipart/form-data", value = "/compress-pdf")
|
||||
|
||||
@@ -146,8 +146,8 @@ public class CertSignController {
|
||||
summary = "Sign PDF with a Digital Certificate",
|
||||
description =
|
||||
"This endpoint accepts a PDF file, a digital certificate and related"
|
||||
+ " information to sign the PDF. It then returns the digitally signed PDF"
|
||||
+ " file. Input:PDF Output:PDF Type:SISO")
|
||||
+ " information to sign the PDF. It then returns the digitally signed PDF"
|
||||
+ " file. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> signPDFWithCert(@ModelAttribute SignPDFWithCertRequest request)
|
||||
throws Exception {
|
||||
MultipartFile pdf = request.getFileInput();
|
||||
|
||||
@@ -622,8 +622,8 @@ public class GetInfoOnPDF {
|
||||
permissionsNode.put("Document Assembly", getPermissionState(ap.canAssembleDocument()));
|
||||
permissionsNode.put("Extracting Content", getPermissionState(ap.canExtractContent()));
|
||||
permissionsNode.put(
|
||||
"Extracting for accessibility",
|
||||
getPermissionState(ap.canExtractForAccessibility()));
|
||||
"Extracting for accessibility",
|
||||
getPermissionState(ap.canExtractForAccessibility()));
|
||||
permissionsNode.put("Form Filling", getPermissionState(ap.canFillInForm()));
|
||||
permissionsNode.put("Modifying", getPermissionState(ap.canModify()));
|
||||
permissionsNode.put("Modifying annotations", getPermissionState(ap.canModifyAnnotations()));
|
||||
|
||||
@@ -28,8 +28,7 @@ public class LanguageService {
|
||||
|
||||
public Set<String> getSupportedLanguages() {
|
||||
try {
|
||||
Resource[] resources =
|
||||
resourcePatternResolver.getResources("classpath*:messages_*.properties");
|
||||
Resource[] resources = getResourcesFromPattern("classpath*:messages_*.properties");
|
||||
|
||||
return Arrays.stream(resources)
|
||||
.map(Resource::getFilename)
|
||||
@@ -54,4 +53,9 @@ public class LanguageService {
|
||||
return new HashSet<>();
|
||||
}
|
||||
}
|
||||
|
||||
// Protected method to allow overriding in tests
|
||||
protected Resource[] getResourcesFromPattern(String pattern) throws IOException {
|
||||
return resourcePatternResolver.getResources(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user