[
https://issues.apache.org/jira/browse/PDFBOX-4383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695025#comment-16695025
]
ASF subversion and git services commented on PDFBOX-4383:
---------------------------------------------------------
Commit 1847126 from [email protected] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1847126 ]
PDFBOX-4383: don't store file as FileInputStream, add "previously failing" test
> 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
> Assignee: Tilman Hausherr
> Priority: Major
>
> Hi,
>
> Having migrated from 2.0.11 to 2.0.12. I am facing the following issue:
>
> When merging multiple pdf files into one, I can no longer delete the source
> files.
>
> Here is a sample code (worked in 2.0.11):
>
> {code:java}
> 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 or do I do something wrong ?
>
> 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]