You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2018/11/21 18:26:00 UTC

[jira] [Resolved] (PDFBOX-4383) PDFMergerUtility seems to leave source file open

     [ https://issues.apache.org/jira/browse/PDFBOX-4383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-4383.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.0.0 PDFBox
                   2.0.13

> 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
>             Fix For: 2.0.13, 3.0.0 PDFBox
>
>
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org