diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-02-15 13:56:39 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-02-15 13:56:39 +0100 |
commit | 0c1bea550142c9e1571ced54976cb0167b2fc55b (patch) | |
tree | 076f4d4afe6ad65667e9cd819d7074a9c45adf52 /pdf-as-pdfbox | |
parent | aa99f5b7512a5019b71616f9589a7a5bbfc403da (diff) | |
download | pdf-as-4-0c1bea550142c9e1571ced54976cb0167b2fc55b.tar.gz pdf-as-4-0c1bea550142c9e1571ced54976cb0167b2fc55b.tar.bz2 pdf-as-4-0c1bea550142c9e1571ced54976cb0167b2fc55b.zip |
Automatic positioning with footer line fix
Diffstat (limited to 'pdf-as-pdfbox')
-rw-r--r-- | pdf-as-pdfbox/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 28 |
1 files changed, 27 insertions, 1 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 dfe31ef8..7bb300ad 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 @@ -329,7 +329,7 @@ public class PDFPage extends PDFTextStripper { int pageRotation = this.getCurrentPage().findRotation(); // logger_.debug("PageRotation = " + pageRotation); - if (pageRotation == 0) { + /*if (pageRotation == 0) { current_y = text.getY(); } if (pageRotation == 90) { @@ -350,8 +350,34 @@ public class PDFPage extends PDFTextStripper { // store ypos of the char if it is not empty if (current_y > this.max_character_ypos) { this.max_character_ypos = current_y; + }*/ + + if (pageRotation == 0) { + current_y = text.getY(); + } + if (pageRotation == 90) { + current_y = text.getX(); + } + if (pageRotation == 180) { + float page_height = this.getCurrentPage().findMediaBox().getHeight(); + current_y = page_height - text.getY(); + } + if (pageRotation == 270) { + float page_height = this.getCurrentPage().findMediaBox().getHeight(); + current_y = page_height - text.getX(); + } + + if (current_y > this.effectivePageHeight) { + // logger_.debug("character is below footer_line. footer_line = " + + // this.footer_line + ", text.character=" + character + ", y=" + + // current_y); + return; } + // store ypos of the char if it is not empty + if (current_y > this.max_character_ypos) { + this.max_character_ypos = current_y; + } } // use this funtion getting an unsorted text output |