diff options
author | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-03-05 16:26:31 +0000 |
---|---|---|
committer | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-03-05 16:26:31 +0000 |
commit | 6166fe05b9b8accb885ebd43cce9ee29b035c0a4 (patch) | |
tree | e3054d9a2218e9c55727a7b0726e808a39621451 /src/main/java/at | |
parent | ec7f8a2bfb3acfb2b0f9ec16ad7003e719a179f2 (diff) | |
download | pdf-as-3-6166fe05b9b8accb885ebd43cce9ee29b035c0a4.tar.gz pdf-as-3-6166fe05b9b8accb885ebd43cce9ee29b035c0a4.tar.bz2 pdf-as-3-6166fe05b9b8accb885ebd43cce9ee29b035c0a4.zip |
some changes
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@46 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 59a4987..7cd5b29 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -1041,7 +1041,7 @@ public abstract class PdfAS public static PositioningInstruction adjustSignatureTableandCalculatePosition(
final byte[] pdf, PdfPTable pdf_table, TablePos pos) throws PDFDocumentException
{
- //first check pageinstruction in TablePos-object
+ //first check pageinstruction in TablePos-object
//new,auto,absolut
PdfReader reader = readInPdfDocument(pdf);
//get pages of currentdocument
@@ -1068,14 +1068,19 @@ public abstract class PdfAS //we do have absolute x
pre_pos_x = pos.getPosX();
}
- final float pos_x = pre_pos_x;
//calculate width
- float pre_width = page_width - pos_x - SIGNATURE_BORDER / 2;
+ //center
+ float pre_width = page_width - pre_pos_x - pre_pos_x;
if (!pos.isWauto())
{
//we do have absolute width
pre_width = pos.getWidth();
- }
+ if (pos.isXauto())
+ { //center x
+ pre_pos_x = (page_width - pre_width) / 2;
+ }
+ }
+ final float pos_x = pre_pos_x;
final float width = pre_width;
//Signatur table dimensions are complete
pdf_table.setTotalWidth(width);
@@ -1101,28 +1106,43 @@ public abstract class PdfAS 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
- //Now we have to getfreespace in page and reguard footerline
+ //Now we have to getfreespace in page and reguard footerline
float footer_line = pos.getFooterLine();
float pre_page_length = PDFUtilities.calculatePageLength(pdf, page-1, page_height-footer_line);
if (pre_page_length == Float.NEGATIVE_INFINITY)
{
- //we do have an empty page
- //pre_page_length = page_height;
- pos_y = page_height - SIGNATURE_BORDER / 2;
+ //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;
+ if (pos_y - footer_line <= table_height)
+ {
+ make_new_page = true;
+ if (!pos.isPauto())
+ {
+ //we have to correct pagenumber
+ page = reader.getNumberOfPages();
+ }
+ page++;
+ //no text --> SIGNATURE_BORDER
+ pos_y = page_height - SIGNATURE_BORDER / 2;
+ }
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;
if (pos_y - footer_line <= table_height)
{
make_new_page = true;
if (!pos.isPauto())
- {
- page = reader.getNumberOfPages();
-
+ {
+ //we have to correct pagenumber in case of absolute page and not enough space
+ page = reader.getNumberOfPages();
}
page++;
- pos_y = page_height - SIGNATURE_BORDER / 2;
+ //no text --> SIGNATURE_BORDER
+ pos_y = page_height - SIGNATURE_BORDER / 2;
}
return new PositioningInstruction(make_new_page, page, pos_x, pos_y);
}
|