aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2015-04-21 11:42:57 +0200
committerChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2015-04-21 11:42:57 +0200
commit541f9cbc07355d53b8eba9e1f3576d928b114bdb (patch)
treefdfa0798e00b7465e38f4855b0f005d46f75fbfc
parentb8a81cf495fe905ab076d15c0f71c0ea0f93a216 (diff)
downloadpdf-as-4-541f9cbc07355d53b8eba9e1f3576d928b114bdb.tar.gz
pdf-as-4-541f9cbc07355d53b8eba9e1f3576d928b114bdb.tar.bz2
pdf-as-4-541f9cbc07355d53b8eba9e1f3576d928b114bdb.zip
fixed automatic sig-placement for rotated pdfs
-rw-r--r--pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java20
1 files changed, 8 insertions, 12 deletions
diff --git a/pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
index 5a3711a4..fab63e2f 100644
--- a/pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
+++ b/pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java
@@ -320,15 +320,13 @@ public class PDFPage extends PDFTextStripper {
current_y = text.getY();
}
if (pageRotation == 90) {
- current_y = text.getX();
+ current_y = text.getY();
}
if (pageRotation == 180) {
- float page_height = this.getCurrentPage().findMediaBox().getHeight();
- current_y = page_height - text.getY();
+ current_y = text.getY();
}
if (pageRotation == 270) {
- float page_height = this.getCurrentPage().findMediaBox().getHeight();
- current_y = page_height - text.getX();
+ current_y = text.getY();
}
if (current_y > this.effectivePageHeight) {
@@ -454,10 +452,8 @@ public class PDFPage extends PDFTextStripper {
if (pageRotation == 180) {
float min_y = findMinY(transformed_coordinates);
logger.debug("min_y = " + min_y);
- float page_height = this.mypage.getCurrentPage().findMediaBox().getHeight();
- actual_lowest_point = page_height
- - findMaxY(transformed_coordinates);
- actual_starting_point = page_height - min_y;
+ actual_lowest_point = findMaxY(transformed_coordinates);
+ actual_starting_point = actual_lowest_point + min_y;
}
if (pageRotation == 270) {
float min_x = findMinX(transformed_coordinates);
@@ -581,14 +577,14 @@ public class PDFPage extends PDFTextStripper {
current_y = page_height - anno.getRectangle().getLowerLeftY();
}
if (pageRotation == 90) {
- current_y = anno.getRectangle().getLowerLeftX();
+ current_y = anno.getRectangle().getUpperRightX();
}
if (pageRotation == 180) {
current_y = anno.getRectangle().getUpperRightY();
}
if (pageRotation == 270) {
- float page_height = page.findMediaBox().getHeight();
- current_y = page_height - anno.getRectangle().getUpperRightX();
+ float page_width = page.findMediaBox().getWidth();
+ current_y = page_width - anno.getRectangle().getLowerLeftX() ;
}
if (current_y > this.effectivePageHeight) {