aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/knowcenter/wag
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-07 09:24:50 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-07 09:24:50 +0200
commite9410c03edfcfee9b6aa6dc5a27d6532292d72d8 (patch)
treecdd49db93bb347ebfc1073c194286efef2790919 /pdf-as-lib/src/main/java/at/knowcenter/wag
parentaf2d6dad0711f95c280621b94f7ca3da8f91632a (diff)
downloadpdf-as-4-e9410c03edfcfee9b6aa6dc5a27d6532292d72d8.tar.gz
pdf-as-4-e9410c03edfcfee9b6aa6dc5a27d6532292d72d8.tar.bz2
pdf-as-4-e9410c03edfcfee9b6aa6dc5a27d6532292d72d8.zip
Fixed Annotation without page warning
Diffstat (limited to 'pdf-as-lib/src/main/java/at/knowcenter/wag')
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java16
1 files changed, 13 insertions, 3 deletions
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 f2cd4085..4ce8daa9 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
@@ -537,11 +537,21 @@ public class PDFPage extends PDFTextStripper {
public void processAnnotation(PDAnnotation anno) {
float current_y = anno.getRectangle().getLowerLeftY();
+ PDPage page = anno.getPage();
- int pageRotation = anno.getPage().findRotation();
+ if(page == null) {
+ page = getCurrentPage();
+ }
+
+ if(page == null) {
+ logger.warn("Annotation without page! The position might not be correct!");
+ return;
+ }
+
+ int pageRotation = page.findRotation();
// logger_.debug("PageRotation = " + pageRotation);
if (pageRotation == 0) {
- float page_height = anno.getPage().findMediaBox().getHeight();
+ float page_height = page.findMediaBox().getHeight();
current_y = page_height - anno.getRectangle().getLowerLeftY();
}
if (pageRotation == 90) {
@@ -551,7 +561,7 @@ public class PDFPage extends PDFTextStripper {
current_y = anno.getRectangle().getUpperRightY();
}
if (pageRotation == 270) {
- float page_height = anno.getPage().findMediaBox().getHeight();
+ float page_height = page.findMediaBox().getHeight();
current_y = page_height - anno.getRectangle().getUpperRightX();
}