This commit is contained in:
Balázs Szücs 2025-12-18 17:21:49 +00:00 committed by GitHub
commit 1ea14c8e21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 0 deletions

View File

@ -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(

View File

@ -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;
}

View File

@ -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"

View File

@ -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

View File

@ -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.")
}
]
};

View File

@ -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;
};