mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
Merge b5754aaf69 into 3529849bca
This commit is contained in:
commit
1ea14c8e21
@ -92,6 +92,7 @@ public class OCRController {
|
||||
String ocrType = request.getOcrType();
|
||||
String ocrRenderType = request.getOcrRenderType();
|
||||
Boolean removeImagesAfter = request.isRemoveImagesAfter();
|
||||
boolean invalidateDigitalSignatures = request.isInvalidateDigitalSignatures();
|
||||
|
||||
if (selectedLanguages == null || selectedLanguages.isEmpty()) {
|
||||
throw ExceptionUtils.createOcrLanguageRequiredException();
|
||||
@ -130,6 +131,7 @@ public class OCRController {
|
||||
ocrType,
|
||||
ocrRenderType,
|
||||
removeImagesAfter,
|
||||
invalidateDigitalSignatures,
|
||||
tempInputFile.getPath(),
|
||||
tempOutputFile.getPath(),
|
||||
sidecarTextFile != null ? sidecarTextFile.getPath() : null);
|
||||
@ -203,6 +205,7 @@ public class OCRController {
|
||||
String ocrType,
|
||||
String ocrRenderType,
|
||||
Boolean removeImagesAfter,
|
||||
boolean invalidateDigitalSignatures,
|
||||
Path tempInputFile,
|
||||
Path tempOutputFile,
|
||||
Path sidecarTextPath)
|
||||
@ -243,6 +246,9 @@ public class OCRController {
|
||||
command.add("--force-ocr");
|
||||
}
|
||||
}
|
||||
if (invalidateDigitalSignatures) {
|
||||
command.add("--invalidate-digital-signatures");
|
||||
}
|
||||
|
||||
command.addAll(
|
||||
Arrays.asList(
|
||||
|
||||
@ -46,4 +46,9 @@ public class ProcessPdfWithOcrRequest extends PDFFile {
|
||||
|
||||
@Schema(description = "Remove images from the output PDF if set to true")
|
||||
private boolean removeImagesAfter;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Invalidate digital signatures in the PDF to allow OCR processing. WARNING: This will make any digital signatures in the document invalid.")
|
||||
private boolean invalidateDigitalSignatures;
|
||||
}
|
||||
|
||||
@ -2028,6 +2028,10 @@ help = "Please read this documentation on how to use this for other languages an
|
||||
credit = "This service uses qpdf and Tesseract for OCR."
|
||||
submit = "Process PDF with OCR"
|
||||
|
||||
[ocr.invalidateSignatures]
|
||||
label = "Invalidate digital signatures"
|
||||
warning = "Warning: Enabling this option will invalidate any digital signatures in the PDF. The document will no longer be legally valid as a signed document."
|
||||
|
||||
[ocr.selectText]
|
||||
1 = "Select languages that are to be detected within the PDF (Ones listed are the ones currently detected):"
|
||||
2 = "Produce text file containing OCR text alongside the OCR'ed PDF"
|
||||
|
||||
@ -35,6 +35,7 @@ const AdvancedOCRSettings: React.FC<AdvancedOCRSettingsProps> = ({
|
||||
{ value: 'deskew', label: t('ocr.settings.advancedOptions.deskew', 'Deskew pages'), isSpecial: false },
|
||||
{ value: 'clean', label: t('ocr.settings.advancedOptions.clean', 'Clean input file'), isSpecial: false },
|
||||
{ value: 'cleanFinal', label: t('ocr.settings.advancedOptions.cleanFinal', 'Clean final output'), isSpecial: false },
|
||||
{ value: 'invalidateDigitalSignatures', label: t('ocr.invalidateSignatures.label', 'Invalidate digital signatures'), isSpecial: false },
|
||||
];
|
||||
|
||||
// Handle individual checkbox changes
|
||||
|
||||
@ -28,6 +28,10 @@ export const useAdvancedOCRTips = (): TooltipContent => {
|
||||
{
|
||||
title: t("ocr.tooltip.advanced.cleanFinal.title", "Clean Final Output"),
|
||||
description: t("ocr.tooltip.advanced.cleanFinal.text", "Post-processes the final PDF by removing OCR artefacts and optimising the text layer for better readability and smaller file size.")
|
||||
},
|
||||
{
|
||||
title: t("ocr.invalidateSignatures.label", "Invalidate digital signatures"),
|
||||
description: t("ocr.invalidateSignatures.warning", "Warning: Enabling this option will invalidate any digital signatures in the PDF. The document will no longer be legally valid as a signed document.")
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@ -49,6 +49,7 @@ export const buildOCRFormData = (parameters: OCRParameters, file: File): FormDat
|
||||
formData.append('clean', parameters.additionalOptions.includes('clean').toString());
|
||||
formData.append('cleanFinal', parameters.additionalOptions.includes('cleanFinal').toString());
|
||||
formData.append('removeImagesAfter', parameters.additionalOptions.includes('removeImagesAfter').toString());
|
||||
formData.append('invalidateDigitalSignatures', parameters.additionalOptions.includes('invalidateDigitalSignatures').toString());
|
||||
return formData;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user