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 --- .../at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java') diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java index a0311da..7de89d2 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java @@ -74,22 +74,22 @@ public class PDFPage extends PDFTextStripper protected float max_image_ypos = Float.NEGATIVE_INFINITY; /** - * The y coordinate of the footer line. PDF elements below this footer line will not be regarded. + * The effective page height. */ - protected float footer_line = 0.0f; + protected float effectivePageHeight; /** * Constructor. * - * @param footer_line The y coordinate of the footer line. PDF elements below this footer line will not be regarded. + * @param effectivePageHeight The height of the page to be evaluated. PDF elements outside this height will not be considered. * * @throws IOException */ - public PDFPage(float footer_line) throws IOException + public PDFPage(float effectivePageHeight) throws IOException { super(); - this.footer_line = footer_line; + this.effectivePageHeight = effectivePageHeight; OperatorProcessor newInvoke = new MyInvoke(); newInvoke.setContext(this); @@ -140,9 +140,8 @@ public class PDFPage extends PDFTextStripper float page_height = page.findMediaBox().getHeight(); current_y = page_height - text.getX(); } - - - if (current_y > this.footer_line) + + if (current_y > this.effectivePageHeight) { //logger_.debug("character is below footer_line. footer_line = " + this.footer_line + ", text.character=" + character + ", y=" + current_y); return; @@ -152,12 +151,8 @@ public class PDFPage extends PDFTextStripper if (!character.equals(" ") && current_y > this.max_character_ypos) { this.max_character_ypos = current_y; - //logger_.debug("text.character=" + character + ", y=" + current_y); - // System.err.println(character + "|" + current_y); } - //logger_.error("text.character=" + character + ", y=" + current_y + " max_c=" + this.max_character_ypos); - // System.err.println(character + "|" + current_y); } // use this funtion getting an unsorted text output @@ -182,7 +177,7 @@ public class PDFPage extends PDFTextStripper { max_ypos = this.max_image_ypos; } - //logger_.error("max len=" + max_ypos); + return max_ypos; } @@ -192,7 +187,6 @@ public class PDFPage extends PDFTextStripper public void process(PDFOperator operator, List arguments) throws IOException { COSName name = (COSName) arguments.get(0); - //logger_.error(""); // PDResources res = context.getResources(); @@ -203,13 +197,12 @@ public class PDFPage extends PDFTextStripper COSStream cos_stream = stream.getStream(); COSName subtype = (COSName) cos_stream.getDictionaryObject(COSName.SUBTYPE); - //logger_.error(""); if (subtype.equals(COSName.IMAGE)) { - //logger_.error("XObject Image"); + logger_.debug("XObject Image"); Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix(); - //logger_.debug("ctm = " + ctm); + logger_.debug("ctm = " + ctm); Pos [] coordinates = new Pos [] { new Pos(0, 0, 1), @@ -275,9 +268,9 @@ public class PDFPage extends PDFTextStripper logger_.debug("actual_lowest_point = " + actual_lowest_point); - if (actual_lowest_point > PDFPage.this.footer_line && actual_starting_point > PDFPage.this.footer_line) + if (actual_lowest_point > PDFPage.this.effectivePageHeight && actual_starting_point > PDFPage.this.effectivePageHeight) { - logger_.debug("image is below footer_line. footer_line = " + PDFPage.this.footer_line); + logger_.debug("image is below footer_line"); return; } -- cgit v1.2.3