pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Questions regarding PDFMergerUtility
Date Sat, 09 Mar 2019 16:57:53 GMT
What PDFBox version are you using? Can you reproduce the effect with one 
single file? Can you share this file?

Tilman

Am 09.03.2019 um 17:18 schrieb JZ Q:
> Hi everyone,
>
> I used the following code fragment to merge over 100 one-page pdf file into
> a single PDF file; then try to remove the original one page files. But it
> seems like the PDFmerger utility still holds the handle to the original
> file. Why? How to fix it?
>
> Thanks.
>
>
> PDFMergerUtility PDFmerger = new PDFMergerUtility();
> File mergeFile = new File(outputDir, "Envelopes-" +
> MyFileUtil.getStringAsTodayYYYYMMDD() + ".pdf");
> PDFmerger.setDestinationFileName(mergeFile.getAbsolutePath());
>
> for (File output : pdfFiles) {
> PDFmerger.addSource(output);
> }
> PDFmerger.mergeDocuments(null);
>
> // remove:
> for (File output : pdfFiles) {
> boolean rt = output.delete();
> if (!rt) {
> System.out.println("Failed to delete " + output.toString());
> }
> }
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message