diff options
-rw-r--r-- | pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 16 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/package-info.java | 8 |
2 files changed, 13 insertions, 11 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(); } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/package-info.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/package-info.java deleted file mode 100644 index 0ed0acfc..00000000 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.web.ws;
\ No newline at end of file |