summaryrefslogtreecommitdiff
path: root/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:09:50 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:09:50 +0000
commit880f96c5fd18d760f85e6814cb77ca908c4d8dc4 (patch)
treeeeac737f443ac20bb1b6de3f3c5c76ff289c8006 /pdf-over-signer/pdf-over-sigpdfas/src/main/java/at
parentbd5daf390a73c3b21f7e796ec52e2f333c8206b9 (diff)
downloadpdf-over-880f96c5fd18d760f85e6814cb77ca908c4d8dc4.tar.gz
pdf-over-880f96c5fd18d760f85e6814cb77ca908c4d8dc4.tar.bz2
pdf-over-880f96c5fd18d760f85e6814cb77ca908c4d8dc4.zip
+ fixed placeholder scaling added scaling for padding
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@167 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-signer/pdf-over-sigpdfas/src/main/java/at')
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java24
1 files changed, 15 insertions, 9 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 3ca1ace1..0e1f64d5 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
@@ -146,7 +146,13 @@ public class PdfAsSignatureParameter extends SignatureParameter {
float[] heights = this.getTableHeights(table, table.getStyle(),
height);
- log.info("Width: " + width + " Height: " + height);
+ float mheigh = 0;
+
+ for(int i = 0; i < heights.length; i++) {
+ mheigh += heights[i];
+ }
+
+ log.info("Width: " + width + " Height: " + height + " HShould: " + mheigh);
BufferedImage image = new BufferedImage((int) width, (int) height,
BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
@@ -263,7 +269,7 @@ public class PdfAsSignatureParameter extends SignatureParameter {
float perUnit = width / sum;
- int padding = (int) (style.getPadding() * this.perUnitHeight);
+ int padding = (int) (style.getPadding() * this.perUnitHeight * PLACEHOLDER_SCALE);
ArrayList rows = table.getRows();
float roffset = 0;
@@ -283,7 +289,7 @@ public class PdfAsSignatureParameter extends SignatureParameter {
(int) (colWidths[j] * perUnit), rsize);
g.drawString(entry.getValue().toString(), (int) (xoff
- + offset + padding), (int) (yoff + padding
+ + offset + padding / PLACEHOLDER_SCALE), (int) (yoff + padding
+ roffset + font.getSize() * this.perUnitHeight));
} else if (entry.getType() == 2) {
// Image ...
@@ -308,8 +314,8 @@ public class PdfAsSignatureParameter extends SignatureParameter {
g.drawImage(
img,
- (int) (xoff + offset + padding + (((colWidths[j] * perUnit) - imgWidth - padding)) / 2),
- (int) (yoff + roffset + padding + ((rsize - imgHeight - padding) / 2)),
+ (int) (xoff + offset + padding + (((colWidths[j] * perUnit) - imgWidth - 2* padding)) / 2),
+ (int) (yoff + roffset + padding + ((rsize - imgHeight - 2* padding) / 2)),
null);
} catch (IOException e) {
log.warn("Failed to paint emblem to placeholder image");
@@ -375,8 +381,8 @@ public class PdfAsSignatureParameter extends SignatureParameter {
fontSize = Integer.parseInt(font_arr[1]) * PLACEHOLDER_SCALE;
}
- if (rsize < ((style.getPadding() * 2) + fontSize)) {
- rsize = ((style.getPadding() * 2) + fontSize);
+ if (rsize < ((style.getPadding() * PLACEHOLDER_SCALE * 2) + fontSize)) {
+ rsize = ((style.getPadding() * PLACEHOLDER_SCALE * 2) + fontSize);
}
} else if (entry.getType() == 3) {
tsize = this
@@ -416,8 +422,8 @@ public class PdfAsSignatureParameter extends SignatureParameter {
fontSize = Integer.parseInt(font_arr[1]) * PLACEHOLDER_SCALE;
}
- if (rsize < ((style.getPadding() * 2) + fontSize)) {
- rsize = ((style.getPadding() * 2) + fontSize);
+ if (rsize < ((style.getPadding() * PLACEHOLDER_SCALE * 2) + fontSize)) {
+ rsize = ((style.getPadding() * PLACEHOLDER_SCALE * 2) + fontSize);
}
} else if (entry.getType() == 3) {
tsize = this