From d328326156cdfbf96581f0f22b3b0d195fbc6858 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 1 Sep 2022 13:16:36 +0200 Subject: cleanup emblem handling --- .../main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 3 +++ .../at/asit/pdfover/gui/workflow/states/PositioningState.java | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main') 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()) -- cgit v1.2.3