diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 14:39:01 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 14:39:01 +0200 |
commit | 209f81ea544762f25aedf10551e33feef74272b5 (patch) | |
tree | 9e8292ecb439733ed29ea0f5eb502d90d531862b /pdf-over-signer/src/main/java/at/asit/pdfover/signer | |
parent | 98897fa9be7c9620352eb39a9c434a06cf151db1 (diff) | |
download | pdf-over-209f81ea544762f25aedf10551e33feef74272b5.tar.gz pdf-over-209f81ea544762f25aedf10551e33feef74272b5.tar.bz2 pdf-over-209f81ea544762f25aedf10551e33feef74272b5.zip |
fix scaling mm -> pdf units
Diffstat (limited to 'pdf-over-signer/src/main/java/at/asit/pdfover/signer')
-rw-r--r-- | pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java | 9 | ||||
-rw-r--r-- | pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java | 5 |
2 files changed, 8 insertions, 6 deletions
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 |