Fix chiusura file nel merge dei pdf
This commit is contained in:
parent
887e0846be
commit
9c5045333e
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -592,9 +593,17 @@ public final class AEnv
|
||||||
DocumentException, FileNotFoundException {
|
DocumentException, FileNotFoundException {
|
||||||
Document document = null;
|
Document document = null;
|
||||||
PdfWriter copy = null;
|
PdfWriter copy = null;
|
||||||
|
|
||||||
|
List<PdfReader> pdfReaders = new ArrayList<PdfReader>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
for (File f : pdfList)
|
for (File f : pdfList)
|
||||||
{
|
{
|
||||||
PdfReader reader = new PdfReader(f.getAbsolutePath());
|
PdfReader reader = new PdfReader(f.getAbsolutePath());
|
||||||
|
|
||||||
|
pdfReaders.add(reader);
|
||||||
|
|
||||||
if (document == null)
|
if (document == null)
|
||||||
{
|
{
|
||||||
document = new Document(reader.getPageSizeWithRotation(1));
|
document = new Document(reader.getPageSizeWithRotation(1));
|
||||||
|
@ -613,6 +622,14 @@ public final class AEnv
|
||||||
}
|
}
|
||||||
document.close();
|
document.close();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
for(PdfReader reader:pdfReaders)
|
||||||
|
{
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get window title
|
* Get window title
|
||||||
|
|
Loading…
Reference in New Issue