From a0de2a3b2a5f4a99f280f5caebbca0d183ae109a Mon Sep 17 00:00:00 2001 From: tknall Date: Wed, 7 Feb 2007 10:08:21 +0000 Subject: Bugfix: Querformat, BKU 2.7.x, ... git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@35 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 34 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java index c98aee8..c1d6681 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java @@ -66,14 +66,23 @@ public class PDFPage extends PDFTextStripper protected float max_image_ypos = Float.NEGATIVE_INFINITY; /** - * The empty constructor. + * The y coordinate of the footer line. PDF elements below this footer line will not be regarded. + */ + protected float footer_line = 0.0f; + + /** + * Constructor. + * + * @param footer_line The y coordinate of the footer line. PDF elements below this footer line will not be regarded. * * @throws IOException */ - public PDFPage() throws IOException + public PDFPage(float footer_line) throws IOException { super(); + this.footer_line = footer_line; + OperatorProcessor newInvoke = new MyInvoke(); newInvoke.setContext(this); operators.put("Do", newInvoke); @@ -341,17 +350,24 @@ public class PDFPage extends PDFTextStripper */ protected void showCharacter(TextPosition text) { - float current_y = text.getY(); - String character = text.getCharacter(); + final float current_y = text.getY(); + final String character = text.getCharacter(); + +// if (current_y > this.footer_line) +// { +// 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 (!character.equals(" ") && current_y > this.max_character_ypos) { this.max_character_ypos = current_y; - //logger_.debug("text.character=" + character + ", y=" + current_y); + logger_.debug("text.character=" + character + ", y=" + current_y); // System.err.println(character + "|" + current_y); } - // logger_.debug("text.character=" + character + ", y=" + current_y); + logger_.debug("text.character=" + character + ", y=" + current_y); // System.err.println(character + "|" + current_y); } @@ -454,6 +470,12 @@ public class PDFPage extends PDFTextStripper logger_.debug("actual_lowest_point = " + actual_lowest_point); + if (actual_lowest_point > PDFPage.this.footer_line) + { + logger_.debug("image is below footer_line. footer_line = " + PDFPage.this.footer_line); + return; + } + if (actual_lowest_point > PDFPage.this.max_image_ypos) { PDFPage.this.max_image_ypos = actual_lowest_point; -- cgit v1.2.3