"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/src/main/java/org/apache/pdfbox/tools/PDFSplit.java" between
pdfbox-2.0.23-src.zip and pdfbox-2.0.24-src.zip

About: Apache PDFBox is a Java PDF library tool that allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PDFSplit.java  (pdfbox-2.0.23-src):PDFSplit.java  (pdfbox-2.0.24-src)
skipping to change at line 24 skipping to change at line 24
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.pdfbox.tools; package org.apache.pdfbox.tools;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.List; import java.util.List;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdfwriter.COSWriter; import org.apache.pdfbox.pdfwriter.COSWriter;
import org.apache.pdfbox.multipdf.Splitter; import org.apache.pdfbox.multipdf.Splitter;
/** /**
* This is the main program that will take a pdf document and split it into * This is the main program that will take a pdf document and split it into
* a number of other documents. * a number of other documents.
* *
* @author Ben Litchfield * @author Ben Litchfield
skipping to change at line 185 skipping to change at line 186
{ {
PDDocument doc = documents.get( i ); PDDocument doc = documents.get( i );
String fileName = outputPrefix + "-" + (i + 1) + ".pdf"; String fileName = outputPrefix + "-" + (i + 1) + ".pdf";
writeDocument( doc, fileName ); writeDocument( doc, fileName );
doc.close(); doc.close();
} }
} }
finally finally
{ {
if( document != null ) if (document != null)
{ {
document.close(); document.close();
} for (int i = 0; i < documents.size(); i++)
for( int i=0; documents != null && i<documents.size(); i++ ) {
{ PDDocument doc = documents.get(i);
PDDocument doc = documents.get(i); IOUtils.closeQuietly(doc);
doc.close(); }
} }
} }
} }
} }
private static void writeDocument( PDDocument doc, String fileName ) throws IOException private static void writeDocument( PDDocument doc, String fileName ) throws IOException
{ {
FileOutputStream output = null; FileOutputStream output = null;
COSWriter writer = null; COSWriter writer = null;
try try
 End of changes. 3 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)