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: [email protected]
For additional commands, e-mail: [email protected]