diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 35 |
1 files changed, 29 insertions, 6 deletions
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 6ac0900..a0311da 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 @@ -117,9 +117,31 @@ public class PDFPage extends PDFTextStripper */
protected void showCharacter(TextPosition text)
{
- final float current_y = text.getY();
+ float current_y = text.getY();
final String character = text.getCharacter();
+ int pageRotation = page.findRotation();
+ //logger_.debug("PageRotation = " + pageRotation);
+ if (pageRotation == 0)
+ {
+ current_y = text.getY();
+ }
+ if (pageRotation == 90)
+ {
+ current_y = text.getX();
+ }
+ if (pageRotation == 180)
+ {
+ float page_height = page.findMediaBox().getHeight();
+ current_y = page_height - text.getY();
+ }
+ if (pageRotation == 270)
+ {
+ float page_height = page.findMediaBox().getHeight();
+ current_y = page_height - text.getX();
+ }
+
+
if (current_y > this.footer_line)
{
//logger_.debug("character is below footer_line. footer_line = " + this.footer_line + ", text.character=" + character + ", y=" + current_y);
@@ -134,7 +156,7 @@ public class PDFPage extends PDFTextStripper // System.err.println(character + "|" + current_y);
}
- //logger_.debug("text.character=" + character + ", y=" + current_y);
+ //logger_.error("text.character=" + character + ", y=" + current_y + " max_c=" + this.max_character_ypos);
// System.err.println(character + "|" + current_y);
}
@@ -160,7 +182,7 @@ public class PDFPage extends PDFTextStripper {
max_ypos = this.max_image_ypos;
}
-
+ //logger_.error("max len=" + max_ypos);
return max_ypos;
}
@@ -170,7 +192,7 @@ public class PDFPage extends PDFTextStripper public void process(PDFOperator operator, List arguments) throws IOException
{
COSName name = (COSName) arguments.get(0);
- //logger_.debug("<Do name=\"" + name.getName() + "\">");
+ //logger_.error("<Do name=\"" + name.getName() + "\">");
// PDResources res = context.getResources();
@@ -181,12 +203,13 @@ public class PDFPage extends PDFTextStripper COSStream cos_stream = stream.getStream();
COSName subtype = (COSName) cos_stream.getDictionaryObject(COSName.SUBTYPE);
+ //logger_.error("<Do subtype name=\"" + subtype.getName() + "\">");
if (subtype.equals(COSName.IMAGE))
{
- logger_.debug("XObject Image");
+ //logger_.error("XObject Image");
Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix();
- logger_.debug("ctm = " + ctm);
+ //logger_.debug("ctm = " + ctm);
Pos [] coordinates = new Pos [] {
new Pos(0, 0, 1),
|