diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-09-01 13:16:36 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-09-01 13:16:36 +0200 |
commit | d328326156cdfbf96581f0f22b3b0d195fbc6858 (patch) | |
tree | c9cfe2b1d6243fef7dedb9496fa02a4683ba5882 | |
parent | 8e553385ab268c216a99b03d15783c563ce748dc (diff) | |
download | pdf-over-d328326156cdfbf96581f0f22b3b0d195fbc6858.tar.gz pdf-over-d328326156cdfbf96581f0f22b3b0d195fbc6858.tar.bz2 pdf-over-d328326156cdfbf96581f0f22b3b0d195fbc6858.zip |
cleanup emblem handling
3 files changed, 8 insertions, 5 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 87ec0c42..bad000ea 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -513,6 +513,9 @@ public class SignaturePanel extends JPanel { */
boolean isOnSignature(int x, int y)
{
+ if (this.sigScreenPos == null)
+ return false;
+
Rectangle2D sig = new Rectangle2D.Double(
this.sigScreenPos.getX() + this.offX,
this.sigScreenPos.getY() + this.offY,
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 febf392a..e3ab559c 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 @@ -110,8 +110,9 @@ public class PositioningState extends State { PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); param.signatureProfile = config.getSignatureProfile(); - Emblem emblem = new Emblem(config.getDefaultEmblemPath()); - param.emblem = emblem; + String emblemPath = config.getDefaultEmblemPath(); + if (emblemPath != null && !emblemPath.trim().isEmpty()) + param.emblem = new Emblem(emblemPath); if (config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) param.signatureNote = config.getSignatureNote(); @@ -120,8 +121,7 @@ public class PositioningState extends State { param.targetLogoSize = Math.min(120.0, config.getLogoOnlyTargetSize()); // TODO WORKAROUND FOR #117 PdfAs4SignaturePlaceholder.For(param, (p) -> { - this.positionComposite.setPlaceholder( - p.getAWTImage()); + this.positionComposite.setPlaceholder(p.getAWTImage()); }); if (this.previousPosition != null && !this.previousPosition.useAutoPositioning()) diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java index 270d21c4..7f2e305c 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java @@ -68,7 +68,7 @@ public class Emblem { if (this.image != null) return; /* getCachedFileName may have re-generated the cache and populated this.image */ try { - image = ImageUtil.readImageWithEXIFRotation(new File(filename)); + this.image = ImageUtil.readImageWithEXIFRotation(new File(filename)); } catch (IOException e) { log.warn("Failed to load Emblem image"); } |