From 797634c687c6f44d314e4baa3fed220d142eed73 Mon Sep 17 00:00:00 2001 From: emusic Date: Mon, 14 May 2018 16:38:43 +0200 Subject: changes in pdf-as-lib --- .../gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pdf-as-pdfbox-2/src/main/java/at') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java index 680abe6d..1a51b4db 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java @@ -29,6 +29,7 @@ import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; +import org.apache.pdfbox.pdmodel.PDPageTree; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -170,7 +171,7 @@ public class Positioning { page = pos.getPage(); // System.out.println("XXXXPAGE="+page+" doc_pages="+doc_pages); - if (page > doc_pages) { + if (page > doc_pages && page!=1) { make_new_page = true; page = doc_pages; // throw new PDFDocumentException(227, "Page number is to big(=" @@ -178,14 +179,15 @@ public class Positioning { // ") cannot be parsed."); } - if (page < doc_pages) { + if (page < doc_pages && page!=1) { page = page - 1; } } PDPage pdPage = pdfDataSource.getPage(page-1); - + //PDPage pdPage = pdfDataSource.getPages().get(page); + PDRectangle cropBox = pdPage.getCropBox(); // fallback to MediaBox if Cropbox not available! -- cgit v1.2.3