Author: tilman
Date: Sat May 18 13:57:57 2024
New Revision: 1917801

URL: http://svn.apache.org/viewvc?rev=1917801&view=rev
Log:
PDFBOX-5580: initialize currentPageNo to 1 and increment after the current page 
so we can restore reverted commit, as suggested by Andreas Lehmkühler

Modified:
    
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java

Modified: 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java?rev=1917801&r1=1917800&r2=1917801&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
 Sat May 18 13:57:57 2024
@@ -125,7 +125,7 @@ public class PDFTextStripper extends Leg
     private String articleStart = "";
     private String articleEnd = "";
 
-    private int currentPageNo = 0;
+    private int currentPageNo = 1;
     private int startPage = 1;
     private int endPage = Integer.MAX_VALUE;
     private PDOutlineItem startBookmark = null;
@@ -205,7 +205,7 @@ public class PDFTextStripper extends Leg
 
     private void resetEngine()
     {
-        currentPageNo = 0;
+        currentPageNo = 1;
         document = null;
         charactersByArticle.clear();
         characterListMapping.clear();
@@ -282,11 +282,11 @@ public class PDFTextStripper extends Leg
 
         for (PDPage page : pages)
         {
-            currentPageNo++;
             if (page.hasContents())
             {
                 processPage(page);
             }
+            currentPageNo++;
         }
     }
 


Reply via email to