summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java5
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java9
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java5
3 files changed, 13 insertions, 6 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 e6f688ef..5e4de95e 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
@@ -94,6 +94,11 @@ public class Constants {
/** File suffix for the signed document */
public final static String SIGNED_SUFFIX = "_signed";
+ public final static double PDF_UNITS_PER_MM = (595.0 / 210.0);
+
+ /** The default target size for logo-only signatures (in mm) */
+ public final static double DEFAULT_LOGO_ONLY_SIZE = 23;
+
/** Local BKU URL */
public static final String LOCAL_BKU_URL = "http://127.0.0.1:3495/http-security-layer-request";
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
index e3c9d3d3..745f10ea 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
@@ -36,6 +36,7 @@ import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.PdfAs;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Profile;
/**
@@ -80,8 +81,8 @@ public class PdfAs4SignatureParameter {
/** Whether so look for placeholder signatures or not. */
public boolean searchForPlaceholderSignatures = false;
- /** The size to scale the logo to */
- public double targetLogoSize = 65.0;
+ /** The size to scale the logo to (in mm) */
+ public double targetLogoSize = Constants.DEFAULT_LOGO_ONLY_SIZE;
/** The signature profile in use */
public Profile signatureProfile = Profile.getDefaultProfile();
@@ -109,8 +110,8 @@ public class PdfAs4SignatureParameter {
int emblemWidth = (this.emblem != null) ? this.emblem.getWidth() : 1;
int emblemHeight = (this.emblem != null) ? this.emblem.getHeight() : 1;
double aspectRatio = ((double)emblemWidth) / emblemHeight;
- double targetWidth = this.targetLogoSize;
- double targetHeight = this.targetLogoSize;
+ double targetWidth = this.targetLogoSize * Constants.PDF_UNITS_PER_MM;
+ double targetHeight = this.targetLogoSize * Constants.PDF_UNITS_PER_MM;
if (aspectRatio < 1)
targetWidth *= aspectRatio;
else
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
index e8933e1d..e0790dfc 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
@@ -5,6 +5,7 @@ import java.util.UUID;
import javax.activation.DataSource;
+import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Profile;
import at.asit.pdfover.signator.ByteArrayDocumentSource;
import at.asit.pdfover.signator.SignResult;
@@ -70,8 +71,8 @@ public class PdfAs4Signer {
int emblemWidth = (parameter.emblem != null) ? parameter.emblem.getWidth() : 1;
int emblemHeight = (parameter.emblem != null) ? parameter.emblem.getHeight() : 1;
double aspectRatio = ((double)emblemWidth) / emblemHeight;
- double targetWidth = parameter.targetLogoSize;
- double targetHeight = parameter.targetLogoSize;
+ double targetWidth = parameter.targetLogoSize * Constants.PDF_UNITS_PER_MM;
+ double targetHeight = parameter.targetLogoSize * Constants.PDF_UNITS_PER_MM;
if (aspectRatio < 1)
targetWidth *= aspectRatio;
else