pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1801862 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java
Date Thu, 13 Jul 2017 18:35:57 GMT
Author: tilman
Date: Thu Jul 13 18:35:57 2017
New Revision: 1801862

URL: http://svn.apache.org/viewvc?rev=1801862&view=rev
Log:
PDFBOX-3869: make MemoryUsageSetting configurations possible, as suggested by Daniel Hamann

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=1801862&r1=1801861&r2=1801862&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 Thu
Jul 13 18:35:57 2017
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.pdfbox.io.MemoryUsageSetting;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.interactive.action.PDAction;
@@ -47,6 +48,26 @@ public class Splitter
 
     private int currentPageNumber = 0;
 
+    private MemoryUsageSetting memoryUsageSetting = null;
+
+    /**
+     * @return the current memory setting.
+     */
+    public MemoryUsageSetting getMemoryUsageSetting()
+    {
+        return memoryUsageSetting;
+    }
+
+    /**
+     * Set the memory setting.
+     * 
+     * @param memoryUsageSetting 
+     */
+    public void setMemoryUsageSetting(MemoryUsageSetting memoryUsageSetting)
+    {
+        this.memoryUsageSetting = memoryUsageSetting;
+    }
+
     /**
      * This will take a document and split into several other documents.
      *
@@ -184,7 +205,8 @@ public class Splitter
      */
     protected PDDocument createNewDocument() throws IOException
     {
-        PDDocument document = new PDDocument();
+        PDDocument document = memoryUsageSetting == null ?
+                                new PDDocument() : new PDDocument(memoryUsageSetting);
         document.getDocument().setVersion(getSourceDocument().getVersion());
         document.setDocumentInformation(getSourceDocument().getDocumentInformation());
         document.getDocumentCatalog().setViewerPreferences(



Mime
View raw message