From a387fd9a39d3556b5e49e407ea5dd48ea9b33ef7 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:24:36 +0000 Subject: + fixed BKU Selection buttons + fixed pdf-as placeholder git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@305 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../signer/pdfas/PdfAsSignatureParameter.java | 53 +++++++++++++++++++-- .../src/main/resources/img/sign_prev_de.png | Bin 0 -> 13580 bytes .../src/main/resources/img/sign_prev_en.png | Bin 0 -> 16968 bytes 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png create mode 100644 pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png (limited to 'pdf-over-signer/pdf-over-sigpdfas') diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 7e1c486e..8ec31d63 100644 --- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -137,7 +137,8 @@ public class PdfAsSignatureParameter extends SignatureParameter { @Override public SignatureDimension getPlaceholderDimension() { // return new SignatureDimension(487, 206); - return new SignatureDimension(getWidth(), getHeight()); + return new SignatureDimension(276, 126); + //return new SignatureDimension(getWidth(), getHeight()); } private static int getWidth() { @@ -186,6 +187,52 @@ public class PdfAsSignatureParameter extends SignatureParameter { @Override public Image getPlaceholder() { + try { + Image logo = null; + try { + if (this.getEmblem() != null + && this.getEmblem().getFileName() != null + && new File(this.getEmblem().getFileName()) + .exists()) { + logo = ImageIO.read(new File(this.getEmblem() + .getFileName())); + + } + } + catch(Exception e) { + log.error("Failed to get emblem ...", e); + } + + Image img = null; + String lang = getSignatureLanguage(); + if (lang != null && lang.equals("en")) { + img = ImageIO.read(PdfAsSignatureParameter.class + .getResourceAsStream("/img/sign_prev_en.png")); + + if(logo != null) { + logo = logo.getScaledInstance(141, 140, + Image.SCALE_SMOOTH); + img.getGraphics().drawImage(logo, 6, 115, null); + } + + } else { + img = ImageIO.read(PdfAsSignatureParameter.class + .getResourceAsStream("/img/sign_prev_de.png")); + + if(logo != null) { + logo = logo.getScaledInstance(141, 140, + Image.SCALE_SMOOTH); + img.getGraphics().drawImage(logo, 6, 115, null); + } + } + return img; + } catch (IOException e) { + return new BufferedImage(getPlaceholderDimension().getWidth(), + getPlaceholderDimension().getHeight(), + BufferedImage.TYPE_INT_RGB); + } + + /* try { PDFASHelper.getPdfAs(); @@ -238,7 +285,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { getPlaceholderDimension().getHeight(), BufferedImage.TYPE_INT_RGB); } - } + }*/ } private Table getSignatureTable() throws SignatureException, SignatureTypesException { @@ -461,7 +508,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { float[] sizes = new float[rows.size()]; Style style = parentstyle; if (table.getStyle() != null) { - style = table.getStyle(); + style = table.getStyle(); } Font font = PdfAsSignatureParameter.getFont(style); g.setFont(font); diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png b/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png new file mode 100644 index 00000000..c8ca09f4 Binary files /dev/null and b/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_de.png differ diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png b/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png new file mode 100644 index 00000000..aa450fcc Binary files /dev/null and b/pdf-over-signer/pdf-over-sigpdfas/src/main/resources/img/sign_prev_en.png differ -- cgit v1.2.3