summaryrefslogtreecommitdiff
path: root/pdf-over-signer/src/main/java/at/asit/pdfover
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-04 13:47:16 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-04 13:47:16 +0200
commit03b80912dc888296647412b0276e7610315fef13 (patch)
tree7f78a2e83c8095b69bad4954eac19c1a405d0e63 /pdf-over-signer/src/main/java/at/asit/pdfover
parentd5f0e45179f9bd70ffadb247fc53cc16a0eeeb67 (diff)
downloadpdf-over-03b80912dc888296647412b0276e7610315fef13.tar.gz
pdf-over-03b80912dc888296647412b0276e7610315fef13.tar.bz2
pdf-over-03b80912dc888296647412b0276e7610315fef13.zip
workaround #110, manually paint a black border
Diffstat (limited to 'pdf-over-signer/src/main/java/at/asit/pdfover')
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java14
1 files changed, 13 insertions, 1 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 aba1e9ac..5898d2d1 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
@@ -19,6 +19,8 @@ package at.asit.pdfover.signer.pdfas;
import iaik.x509.X509Certificate;
+import java.awt.Color;
+import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.HashMap;
@@ -99,7 +101,17 @@ public class PdfAs4SignatureParameter {
SignParameter param = PdfAsFactory.createSignParameter(conf, null, null);
param.setSignatureProfileId(sigProfile);
- return pdfas.generateVisibleSignaturePreview(param, cert, 72 * 4);
+ Image placeholder = pdfas.generateVisibleSignaturePreview(param, cert, 72 * 4);
+
+ // WORKAROUND for #110, manually paint a black border
+ if (!this.signatureProfileName.equals(Profile.BASE_LOGO.name()))
+ {
+ Graphics2D ctx = (Graphics2D)placeholder.getGraphics();
+ ctx.setColor(Color.BLACK);
+ ctx.drawRect(0, 0, placeholder.getWidth(null)-1, placeholder.getHeight(null)-1);
+ }
+
+ return placeholder;
} catch (Exception e) {
log.error("Failed to get signature placeholder", e);
return new BufferedImage(229, 77, BufferedImage.TYPE_INT_RGB);