From 16cf1fdcf1f92579494c53aa25478ab284a8b5d9 Mon Sep 17 00:00:00 2001 From: knowcenter Date: Tue, 13 Mar 2007 12:49:29 +0000 Subject: minor change for pdf-as application first page rotation is now considered onli necessary in pdf-as context git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@52 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/java/org/pdfbox/util/PDFTextStripper.java | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/pdfbox/util/PDFTextStripper.java b/src/main/java/org/pdfbox/util/PDFTextStripper.java index 56e80cc..62efb64 100644 --- a/src/main/java/org/pdfbox/util/PDFTextStripper.java +++ b/src/main/java/org/pdfbox/util/PDFTextStripper.java @@ -72,7 +72,8 @@ import org.apache.log4j.Logger; public class PDFTextStripper extends PDFStreamEngine { private static Logger log = Logger.getLogger(PDFTextStripper.class); - + private int first_page_rotation = 0; + private boolean getFirstPageRotationFromThis = false; private int currentPageNo = 0; private int startPage = 1; private int endPage = Integer.MAX_VALUE; @@ -320,6 +321,17 @@ public class PDFTextStripper extends PDFStreamEngine protected void processPage( PDPage page, COSStream content ) throws IOException { long start = System.currentTimeMillis(); + // System.out.println( "mruhmer processPage page.findRotation()"+page.findRotation()); + // System.out.println( "mruhmer processPage currentPageNo="+currentPageNo); + // System.out.println( "mruhmer processPage page.getRotation()"+page.getRotation()); + + if((currentPageNo==0) ) + { + if (getFirstPageRotationFromThis) + { + page.setRotation(first_page_rotation); + } + } if( log.isDebugEnabled() ) { log.debug( "processPage( " + page + ", " + content + " )" ); @@ -1030,4 +1042,21 @@ public class PDFTextStripper extends PDFStreamEngine { sortByPosition = newSortByPosition; } + /** + * the rotation of the first page 0|90|180|270 + * @param Rotation + * + */ + public void setFirstPageRotation(int Rotation) + { + first_page_rotation = Rotation; + } + /** + * tells if rotation of first handled page should be concerned + * @param newFirstPageRotationFromThis boolean + */ + public void setGetFirstPageRotationFromThis(boolean newFirstPageRotationFromThis) + { + getFirstPageRotationFromThis = newFirstPageRotationFromThis; + } } \ No newline at end of file -- cgit v1.2.3