aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-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