From 49f4b55deefd0970b3f034d8c427b1be077fe247 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Tue, 24 Nov 2020 10:42:50 +0100 Subject: smal fix --- .../pdfover/gui/composites/SimpleConfigurationComposite.java | 8 ++++++-- .../at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 8fd94eb7..18aad38a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -742,16 +742,20 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (selected.equals(Profile.AMTSSIGNATURBLOCK) || selected.equals(Profile.INVISIBLE)){ this.configurationContainer.setDefaultSignaturePosition(new SignaturePosition()); } - + setSignatureProfileSetting(); } void setSignatureProfileSetting(){ + if (this.signer == null){ + log.debug("In setSignatureProfileSettings: Signer was null"); + return; + } try { SignatureParameter param = this.signer.getPDFSigner().newParameter(); param.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); } catch (Exception e){ - log.debug("Cannot save signature profile {}", e.getMessage()); + log.warn("Cannot save signature profile {}", e.getMessage()); } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java index 6dc93ae9..92cece82 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java @@ -72,6 +72,7 @@ public class SignaturePlaceholderCache { final String sigEHshProp = "EHSH"; //$NON-NLS-1$ final String sigPdfAProp = "PDFA"; //$NON-NLS-1$ final String sigNoteProp = "NOTE"; //$NON-NLS-1$ + final String sigProfProp = "PROF"; //$NON-NLS-1$ String sigLang = param.getSignatureLanguage(); String sigEmbl = ""; //$NON-NLS-1$ @@ -89,7 +90,10 @@ public class SignaturePlaceholderCache { String sigNote = param.getProperty("SIG_NOTE"); //$NON-NLS-1$ if (sigNote == null) sigNote = ""; //$NON-NLS-1$ - + String profile = param.getSignatureProfile(); + if (profile == null){ + profile = ""; + } Properties sigProps = new Properties(); // compare cache, try to load if match try { @@ -99,7 +103,7 @@ public class SignaturePlaceholderCache { sigEmbl.equals(sigProps.getProperty(sigEmblProp)) && sigEHsh.equals(sigProps.getProperty(sigEHshProp)) && sigNote.equals(sigProps.getProperty(sigNoteProp)) && - sigPdfA.equals(sigProps.getProperty(sigPdfAProp))) { + sigPdfA.equals(sigProps.getProperty(sigPdfAProp)) ) { log.debug("Placeholder cache hit"); //$NON-NLS-1$ return loadImage(fileDir, imgFileName, imgFileExt); } @@ -120,6 +124,7 @@ public class SignaturePlaceholderCache { sigProps.setProperty(sigEHshProp, sigEHsh); sigProps.setProperty(sigNoteProp, sigNote); sigProps.setProperty(sigPdfAProp, sigPdfA); + sigProps.setProperty(sigProfProp, profile); OutputStream out = new FileOutputStream(new File(fileDir, propFileName)); sigProps.store(out, null); Image img = param.getPlaceholder(); -- cgit v1.2.3