From 1e580545ff0dd4c15ce05045ab1a9573dec6f9d3 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 27 Jun 2023 07:05:44 +0200 Subject: feat(placeholder): add configuration value to disable profile over-write by placehoder information --- .../lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'pdf-as-pdfbox-2/src/main/java') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index 575fbc47..ee0cc4b0 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -155,7 +155,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { signature.setSignDate(Calendar.getInstance()); log.debug("Signing @ " + signature.getSignDate().getTime().toString()); - // extract next QR-code placeholder, if exists + // extract next QR-code placeholder, if exists SignaturePlaceholderData nextPlaceholderData = PlaceholderFilter.checkPlaceholderSignatureLocation( pdfObject.getStatus(), pdfObject.getStatus().getSettings(), pdfObject.getStatus().getSignParamter().getPlaceHolderId()); @@ -164,14 +164,16 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { log.info("Placeholder data found."); signature.setLocation(nextPlaceholderData.getPlaceholderName()); - - // TODO: only over-write if requested - if (nextPlaceholderData.getProfile() != null) { - log.debug("Placeholder Profile set to: {}", nextPlaceholderData.getProfile()); - requestedSignature.setSignatureProfileID(nextPlaceholderData.getProfile()); + if (nextPlaceholderData.getProfile() != null) { + if ( pdfObject.getStatus().getSettings().isValue(IConfigurationConstants.PLACEHOLDER_PROFILE_OVERWRITE, true)) { + log.debug("Placeholder Profile set to: {}", nextPlaceholderData.getProfile()); + requestedSignature.setSignatureProfileID(nextPlaceholderData.getProfile()); - } - } + } else { + log.debug("Placeholder profile over-write is disabled. Using profile from request ... "); + + } + } final SignatureProfileSettings signatureProfileSettings = -- cgit v1.2.3