public class PDFRenderer extends Object
Modifier and Type | Field and Description |
---|---|
protected PDDocument |
document |
Constructor and Description |
---|
PDFRenderer(PDDocument document)
Creates a new PDFRenderer.
|
Modifier and Type | Method and Description |
---|---|
protected PageDrawer |
createPageDrawer(PageDrawerParameters parameters)
Returns a new PageDrawer instance, using the given parameters.
|
BufferedImage |
renderImage(int pageIndex)
Returns the given page as an RGB image at 72 DPI
|
BufferedImage |
renderImage(int pageIndex,
float scale)
Returns the given page as an RGB image at the given scale.
|
BufferedImage |
renderImage(int pageIndex,
float scale,
ImageType imageType)
Returns the given page as an RGB or ARGB image at the given scale.
|
BufferedImage |
renderImageWithDPI(int pageIndex,
float dpi)
Returns the given page as an RGB image at the given DPI.
|
BufferedImage |
renderImageWithDPI(int pageIndex,
float dpi,
ImageType imageType)
Returns the given page as an RGB image at the given DPI.
|
void |
renderPageToGraphics(int pageIndex,
Graphics2D graphics)
Renders a given page to an AWT Graphics2D instance.
|
void |
renderPageToGraphics(int pageIndex,
Graphics2D graphics,
float scale)
Renders a given page to an AWT Graphics2D instance.
|
protected final PDDocument document
public PDFRenderer(PDDocument document)
document
- the document to renderpublic BufferedImage renderImage(int pageIndex) throws IOException
pageIndex
- the zero-based index of the page to be converted.IOException
- if the PDF cannot be readpublic BufferedImage renderImage(int pageIndex, float scale) throws IOException
pageIndex
- the zero-based index of the page to be convertedscale
- the scaling factor, where 1 = 72 DPIIOException
- if the PDF cannot be readpublic BufferedImage renderImageWithDPI(int pageIndex, float dpi) throws IOException
pageIndex
- the zero-based index of the page to be converteddpi
- the DPI (dots per inch) to render atIOException
- if the PDF cannot be readpublic BufferedImage renderImageWithDPI(int pageIndex, float dpi, ImageType imageType) throws IOException
pageIndex
- the zero-based index of the page to be converteddpi
- the DPI (dots per inch) to render atimageType
- the type of image to returnIOException
- if the PDF cannot be readpublic BufferedImage renderImage(int pageIndex, float scale, ImageType imageType) throws IOException
pageIndex
- the zero-based index of the page to be convertedscale
- the scaling factor, where 1 = 72 DPIimageType
- the type of image to returnIOException
- if the PDF cannot be readpublic void renderPageToGraphics(int pageIndex, Graphics2D graphics) throws IOException
pageIndex
- the zero-based index of the page to be convertedgraphics
- the Graphics2D on which to draw the pageIOException
- if the PDF cannot be readpublic void renderPageToGraphics(int pageIndex, Graphics2D graphics, float scale) throws IOException
pageIndex
- the zero-based index of the page to be convertedgraphics
- the Graphics2D on which to draw the pagescale
- the scale to draw the page atIOException
- if the PDF cannot be readprotected PageDrawer createPageDrawer(PageDrawerParameters parameters) throws IOException
IOException
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.