aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-lib/src/configuration/cfg/advancedconfig.properties2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java1
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java18
3 files changed, 13 insertions, 8 deletions
diff --git a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
index 7eb1ec37..d00f2872 100644
--- a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
+++ b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
@@ -41,6 +41,8 @@
# MATCH_MODE_SORTED = 3
#placeholder_mode=
+# Allow profile over-write from placeholder content [true|false], default=true
+#placeholder_profile_overwrite=true
### stop processing it signature-block can not valid placed on document
sigblock.placement.less.space.failing=false
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
index 8314eef6..40a1bb15 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
@@ -47,6 +47,7 @@ public interface IConfigurationConstants {
public static final String PLACEHOLDER_ID = "placeholder_id";
public static final String PLACEHOLDER_MODE = "placeholder_mode";
+ public static final String PLACEHOLDER_PROFILE_OVERWRITE = "placeholder_profile_overwrite";
public static final String PLACEHOLDER_SEARCH_ENABLED = "enable_placeholder_search";
public static final String DEFAULT_SIGNATURE_PROFILE = SIG_OBJECT + SEPERATOR + TYPE + SEPERATOR + DEFAULT;
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 =