From 81ca4e419779d6a71da9d9cbc3fa2dbc0d0c1912 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 31 Oct 2012 16:36:45 +0000 Subject: upscale placeholder image git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12719 3a0b52a2-8410-0410-bc02-ff6273a87459 --- .../signer/pdfas/PdfAsSignatureParameter.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 0af728a1..3ca1ace1 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -55,6 +55,8 @@ public class PdfAsSignatureParameter extends SignatureParameter { static final Logger log = LoggerFactory .getLogger(PdfAsSignatureParameter.class); + private static final int PLACEHOLDER_SCALE = 4; + private HashMap genericProperties = new HashMap(); /** @@ -132,8 +134,8 @@ public class PdfAsSignatureParameter extends SignatureParameter { sign_obj.fillValues(' ', true, false); sign_obj.setKZ(BinarySignator_1_1_0.MY_ID); - float width = getPlaceholderDimension().getWidth(); - float height = getPlaceholderDimension().getHeight(); + float width = getPlaceholderDimension().getWidth() * PLACEHOLDER_SCALE; + float height = getPlaceholderDimension().getHeight() * PLACEHOLDER_SCALE; Table table = sign_obj.getAbstractTable(); @@ -202,9 +204,9 @@ public class PdfAsSignatureParameter extends SignatureParameter { if (font_arr.length != 3) { return Font.decode(def); } - return Font.decode(String.format("%s-%s-%s", font_arr[0], font_arr[2], + Font font = Font.decode(String.format("%s-%s-%s", font_arr[0], font_arr[2], font_arr[1])); - + return font.deriveFont((float) font.getSize() * PLACEHOLDER_SCALE); } /** @@ -222,8 +224,9 @@ public class PdfAsSignatureParameter extends SignatureParameter { if (font_arr.length != 3) { return Font.decode(def); } - return Font.decode(String.format("%s-%s-%s", font_arr[0], font_arr[2], + Font font = Font.decode(String.format("%s-%s-%s", font_arr[0], font_arr[2], font_arr[1])); + return font.deriveFont((float) font.getSize() * PLACEHOLDER_SCALE); } @SuppressWarnings("rawtypes") @@ -298,8 +301,8 @@ public class PdfAsSignatureParameter extends SignatureParameter { + "/" + entry.getValue().toString())); } - int imgWidth = 40; - int imgHeight = 40; + int imgWidth = 40 * PLACEHOLDER_SCALE; + int imgHeight = 40 * PLACEHOLDER_SCALE; Image img = image.getScaledInstance(imgWidth, imgHeight, Image.SCALE_SMOOTH); @@ -366,10 +369,10 @@ public class PdfAsSignatureParameter extends SignatureParameter { if (entry.getType() == 0 || entry.getType() == 1) { String fontString = style.getFont(); String[] font_arr = fontString.split(","); - int fontSize = 8; + int fontSize = 8 * PLACEHOLDER_SCALE; if (font_arr.length == 3) { - fontSize = Integer.parseInt(font_arr[1]); + fontSize = Integer.parseInt(font_arr[1]) * PLACEHOLDER_SCALE; } if (rsize < ((style.getPadding() * 2) + fontSize)) { @@ -407,10 +410,10 @@ public class PdfAsSignatureParameter extends SignatureParameter { if (entry.getType() == 0 || entry.getType() == 1) { String fontString = style.getFont(); String[] font_arr = fontString.split(","); - int fontSize = 8; + int fontSize = 8 * PLACEHOLDER_SCALE; if (font_arr.length == 3) { - fontSize = Integer.parseInt(font_arr[1]); + fontSize = Integer.parseInt(font_arr[1]) * PLACEHOLDER_SCALE; } if (rsize < ((style.getPadding() * 2) + fontSize)) { -- cgit v1.2.3