Is it necessary to call PDDocument#close() after calling
PDPageContentStream#close()? Does the answer apply all cases or only
certain cases? If the latter, what certain cases?

For example, in the following code snippet:

PDDocument  document = new PDDocument();
PDPageContentStream cos = new PDPageContentStream(document, 0);
cos.drawImage(... , etc.
cos.close();
document.close();


Is the last line, `document.close()`, necessary, or has that been handled
sufficiently by the `cos.close()` immediately before it?

Finally, I'm assuming that it is safe to call #close() a second (or third?)
time on a PDDocument or PDPageContentStream. Is that correct? My use case
would be in the finally block where an exception might have left PDDocument
or PDPageContentStream open.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)

Reply via email to