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] [Comment Edited] (PDFBOX-4383) PDFMergerUtility seems to
leave source file open
[ https://issues.apache.org/jira/browse/PDFBOX-4383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695065#comment-16695065 ]
Tilman Hausherr edited comment on PDFBOX-4383 at 11/21/18 6:25 PM:
-------------------------------------------------------------------
The previous change introduced the bug you thankfully reported. I fixed this and also added a test. Until 2.0.13 is released you can try a snapshot:
[https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.13-SNAPSHOT/]
alternatively pass InputStreams and close them yourself (will be slower).
was (Author: tilman):
The previous change introduced the bug you thankfully reported. I fixed this and also added a test. Until 2.0.13 is released you can try a snapshot:
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.13-SNAPSHOT/
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org