> Thad Humphries <thad.humphr...@gmail.com> hat am 21. Juni 2017 um 23:30 > geschrieben: > > > 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? You have to close both, PDDocument at the end.
> 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. It shouldn't be a problem to close PDDocument several times. I'm not sure about PDPageContentStream Andreas > > -- > "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) --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org