diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:06:28 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:06:28 +0000 |
commit | e899aad89b109937ec26469829df6f67b759c093 (patch) | |
tree | faa263aa1fb00bc064b7ae825b0680fb5fb7da33 /pdf-over-signer/pdf-over-sigpdfas/src | |
parent | d427ef149316101e35c889189b3fde7cc4e1bfb2 (diff) | |
download | pdf-over-e899aad89b109937ec26469829df6f67b759c093.tar.gz pdf-over-e899aad89b109937ec26469829df6f67b759c093.tar.bz2 pdf-over-e899aad89b109937ec26469829df6f67b759c093.zip |
upscale placeholder image
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@133 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-signer/pdf-over-sigpdfas/src')
-rw-r--r-- | pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java | 25 |
1 files changed, 14 insertions, 11 deletions
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 0af728a1..3ca1ace1 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 @@ -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<String, String> genericProperties = new HashMap<String, String>(); /** @@ -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)) { |