David Schreck created PDFBOX-4383:
-------------------------------------
Summary: PDFMergerUtility seems to leave source file open
Key: PDFBOX-4383
URL: https://issues.apache.org/jira/browse/PDFBOX-4383
Project: PDFBox
Issue Type: Bug
Components: Utilities
Affects Versions: 2.0.12
Reporter: David Schreck
Hi,
Having migrated from 2.0.11 to 2.0.12. I am facing the following issue:
When merging multiple pdf file into one, I can no longer delete the source
files.
Here is a sample code:
{code:java}
// code placeholder
public void mergePDFFiles(List<File> inFiles, File outFile)
throws InvalidPasswordException, IOException
{
try (OutputStream out = new BufferedOutputStream(new
FileOutputStream(outFile))) {
PDFMergerUtility merger = new PDFMergerUtility();
merger.setDestinationStream(out);
for(File toMerge : inFiles) {
merger.addSource(toMerge);
}
merger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
}
for(File f : inFiles) {
// IOException thrown
FileUtils.forceDelete(f);
}
}
{code}
Has something changed ?
Br,
David Schreck
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]