aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-03-13 12:49:29 +0000
committerknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-03-13 12:49:29 +0000
commit16cf1fdcf1f92579494c53aa25478ab284a8b5d9 (patch)
tree703966cdec29bc71333a5c6571725238eccf810d
parent37c44a6f329123fed82d2b3c996664e9174263e2 (diff)
downloadpdf-as-3-16cf1fdcf1f92579494c53aa25478ab284a8b5d9.tar.gz
pdf-as-3-16cf1fdcf1f92579494c53aa25478ab284a8b5d9.tar.bz2
pdf-as-3-16cf1fdcf1f92579494c53aa25478ab284a8b5d9.zip
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
-rw-r--r--src/main/java/org/pdfbox/util/PDFTextStripper.java31
1 files changed, 30 insertions, 1 deletions
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