> On 4 Mar 2015, at 07:35, Eric Douglas <[email protected]> wrote:
> 
> I'm using org.apache.pdfbox.rendering.PDFRenderer renderPageToGraphics
> method in a GUI component.
> This PDFRenderer requires a document in the constructor.  This render
> method requires the document to be open.  PDDocument.load creates and opens
> the document object.  How much overhead is in this method?

PDDocument.load has significant overhead, opening a PDF is an expensive 
operation.

> I either need to call the load method every time I call the render method,
> or I need to make sure it loads once and call the close method when the
> component gets destroyed?

You want to make sure that you only have one PDDocument open for a given PDF.

> If I don't call the close method I get this message in my logs.
> org.apache.pdfbox.cos.COSDocument finalize
> WARNING: Warning: You did not close a PDF Document

Yep, PDDocument implements Closeable, so you need to call close() on it.

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

Reply via email to