Am 01.03.2017 um 19:56 schrieb Thad Humphries:
I know that PDDocument (and COSDocument) has a close() method, but how do I
reopen PDDocument? I see no open() method. In my merge method (below), if

You have to reload it from a file or a stream.

the global document is closed here (before inDoc.close() as you suggest) or
elsewhere (in another method), won't the next call to
"merger.appendDocument(document, inDoc);" fail?

There is no exception for closing a document that uses resources that have already been closed. That's why the sequence is important:

First save your work
then close all documents the work is based on.


   PDDocument document;
   ...
   protected void mergePdfDoc(byte [] buffer) throws IOException {
     PDFMergerUtility merger = new PDFMergerUtility();
     PDDocument inDoc = PDDocument.load(buffer);
     merger.appendDocument(document, inDoc);
     inDoc.close();
   }

Is there an exception thrown closing an already closed
PDDocument/COSDocument? Or reopening an opened document?

No.

Tilman


As for fonts, all I'm ever using is the PDType1Font fonts, so I think I'm
okay there.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to