summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java14
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java2
6 files changed, 24 insertions, 0 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
index 5e4de95e..fedf0a58 100644
--- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
+++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
@@ -197,6 +197,9 @@ public class Constants {
/** The emblem config parameter */
public static final String CFG_EMBLEM = "EMBLEM";
+ /** The emblem size config parameter */
+ public static final String CFG_LOGO_ONLY_SIZE = "LOGO_ONLY_SIZE";
+
/** The locale config parameter */
public static final String CFG_LOCALE = "LOCALE";
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
index ea26cd9a..5a19c59b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java
@@ -427,6 +427,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
param.signatureLanguage = this.configurationContainer.signatureLocale.getLanguage();
param.enablePDFACompat = this.configurationContainer.signaturePDFACompat;
+ param.targetLogoSize = this.configurationContainer.logoOnlyTargetSize;
String image = this.configurationContainer.getEmblemPath();
if (image != null && !image.trim().isEmpty()) {
param.emblem = new Emblem(image);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
index 51b48c09..9fda1f1f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java
@@ -45,6 +45,9 @@ public class ConfigurationDataInMemory {
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(ConfigurationDataInMemory.class);
+ /** the emblem size (in mm) for logo only signatures */
+ public double logoOnlyTargetSize = Constants.DEFAULT_LOGO_ONLY_SIZE;
+
/** the emblem File */
protected String emblemFile = null;
public String getEmblemPath() { return this.emblemFile; }
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
index f9981878..4a9a7584 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
@@ -85,6 +85,11 @@ public class ConfigurationManager {
diskConfig.load(new FileInputStream(Constants.CONFIG_DIRECTORY + File.separator + getConfigurationFileName()));
setDefaultEmblemPersistent(diskConfig.getProperty(Constants.CFG_EMBLEM));
+ try {
+ String strProp = diskConfig.getProperty(Constants.CFG_LOGO_ONLY_SIZE);
+ if (strProp != null)
+ setLogoOnlyTargetSize(Double.parseDouble(strProp));
+ } catch (NumberFormatException e) { log.info("Invalid value for CFG_LOGO_ONLY_SIZE ignored.", e); }
setDefaultMobileNumberPersistent(diskConfig.getProperty(Constants.CFG_MOBILE_NUMBER));
setRememberMobilePasswordPersistent(Constants.TRUE.equals(diskConfig.getProperty(Constants.CFG_MOBILE_PASSWORD_REMEMBER)));
@@ -270,6 +275,7 @@ public class ConfigurationManager {
props.setProperty(Constants.CFG_PROXY_PASS, proxyPass);
props.setProperty(Constants.CFG_EMBLEM, getDefaultEmblemPersistent());
+ props.setProperty(Constants.CFG_LOGO_ONLY_SIZE, Double.toString(getLogoOnlyTargetSize()));
props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote());
props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent());
if (getRememberMobilePassword())
@@ -512,6 +518,14 @@ public class ConfigurationManager {
return emblem;
}
+ public void setLogoOnlyTargetSize(double v) {
+ this.configuration.logoOnlyTargetSize = v;
+ }
+
+ public double getLogoOnlyTargetSize() {
+ return this.configuration.logoOnlyTargetSize;
+ }
+
public void setProxyHostPersistent(String host) {
if (host == null || host.trim().isEmpty()) {
this.configuration.proxyHost = STRING_EMPTY;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
index 1f23f0ba..2ffb7404 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
@@ -117,6 +117,7 @@ public class PositioningState extends State {
param.signatureLanguage = config.getSignatureLocale().getLanguage();
param.enablePDFACompat = config.getSignaturePdfACompat();
+ param.targetLogoSize = config.getLogoOnlyTargetSize();
PdfAs4SignaturePlaceholder.For(param, (p) -> {
this.positionComposite.setPlaceholder(
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
index 3ab3fcf8..cc0a83a7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -150,6 +150,8 @@ public class PrepareSigningState extends State {
this.state.signatureParameter.signatureProfile = configuration.getSignatureProfile();
+ this.state.signatureParameter.targetLogoSize = configuration.getLogoOnlyTargetSize();
+
this.state.signingState = PdfAs4Signer.prepare(this.state.signatureParameter);
} catch (Exception e) {