You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/10/23 17:25:43 UTC

svn commit: r1813044 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java

Author: tilman
Date: Mon Oct 23 17:25:43 2017
New Revision: 1813044

URL: http://svn.apache.org/viewvc?rev=1813044&view=rev
Log:
PDFBOX-3969: adjust split relative to start page; improve javadoc

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java?rev=1813044&r1=1813043&r2=1813044&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java Mon Oct 23 17:25:43 2017
@@ -107,7 +107,7 @@ public class Splitter
     /**
      * This will set the start page.
      *
-     * @param start the start page
+     * @param start the 1-based start page
      * @throws IllegalArgumentException if the start page is smaller than one.
      */
     public void setStartPage(int start)
@@ -122,7 +122,7 @@ public class Splitter
     /**
      * This will set the end page.
      *
-     * @param end the end page
+     * @param end the 1-based end page
      * @throws IllegalArgumentException if the end page is smaller than one.
      */
     public void setEndPage(int end)
@@ -188,13 +188,13 @@ public class Splitter
      *     return isPrime(pageNumber);
      * }
      * </code>
-     * @param pageNumber the page number to be checked as splitting page
+     * @param pageNumber the 0-based page number to be checked as splitting page
      * 
      * @return true If a new document should be created.
      */
     protected boolean splitAtPage(int pageNumber)
     {
-        return pageNumber % splitLength == 0;
+        return (pageNumber + 1 - Math.max(1, startPage)) % splitLength == 0;
     }
 
     /**