From e0d280a78d86f32866d80a2a7e97db4d5a6292fd Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 28 Jan 2013 17:29:47 +0000 Subject: Minor issues (e.g. source code encoding issues) fixed. Cleanup tasks... git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@929 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../java/at/knowcenter/wag/egov/egiz/PdfAS.java | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java') diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index c222259..fa9d4c1 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -115,7 +115,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation * of the api or the web application. */ - public static final String PDFAS_VERSION = "3.2"; + public static final String PDFAS_VERSION = "3.3-SNAPSHOT"; /** * The key of the strict mode setting. @@ -123,14 +123,14 @@ public abstract class PdfAS public static final String STRICT_MODE_KEY = "strict_mode"; /** - * The left/right border. + * The left/right margin. */ - public static final float SIGNATURE_BORDER = 100f; + public static final float SIGNATURE_MARGIN_HORIZONTAL = 50f; /** - * The top/bottom border. + * The top/bottom margin. */ - public static final float SIGNATURE_MARGIN = 20f; + public static final float SIGNATURE_MARGIN_VERTICAL = 20f; /** * The Mime Type of a PDF document. @@ -1333,19 +1333,11 @@ public abstract class PdfAS Rectangle psize = reader.getPageSizeWithRotation(page); int page_rotation = reader.getPageRotation(page); -// [tknall] for iText 1.x.x: -// float page_width = psize.width(); -// float page_height = psize.height(); - -// [tknall] for iText 2.x.x: -// float page_width = psize.getWidth(); -// float page_height = psize.getHeight(); - float page_width = psize.getWidth(); float page_height = psize.getHeight(); // now we can calculate x-position - float pre_pos_x = SIGNATURE_BORDER / 2; + float pre_pos_x = SIGNATURE_MARGIN_HORIZONTAL; if (!pos.isXauto()) { // we do have absolute x @@ -1353,7 +1345,7 @@ public abstract class PdfAS } // calculate width // center - float pre_width = page_width - pre_pos_x - pre_pos_x; + float pre_width = page_width - 2*pre_pos_x; if (!pos.isWauto()) { // we do have absolute width @@ -1368,6 +1360,7 @@ public abstract class PdfAS // Signatur table dimensions are complete pdf_table.setTotalWidth(width); pdf_table.setLockedWidth(true); + final float table_height = pdf_table.getTotalHeight(); // now check pos_y float pos_y = pos.getPosY(); @@ -1385,7 +1378,7 @@ public abstract class PdfAS { // ignore footer in new page page++; - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } // up to here no checks have to be made if Tablesize and Pagesize are fit @@ -1397,7 +1390,7 @@ public abstract class PdfAS // we do have an empty page or nothing in area above footerline pre_page_length = page_height; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; if (pos_y - footer_line <= table_height) { make_new_page = true; @@ -1408,13 +1401,13 @@ public abstract class PdfAS } page++; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } final float page_length = pre_page_length; // we do have text take SIGNATURE_MARGIN - pos_y = page_height - page_length - SIGNATURE_MARGIN; + pos_y = page_height - page_length - SIGNATURE_MARGIN_VERTICAL; if (pos_y - footer_line <= table_height) { make_new_page = true; @@ -1426,7 +1419,7 @@ public abstract class PdfAS } page++; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } -- cgit v1.2.3