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.
|
AnnotationFilter |
getAnnotationsFilter()
Return the AnnotationFilter.
|
boolean |
isSubsamplingAllowed()
Value indicating if the renderer is allowed to subsample images before drawing, according to
image dimensions and requested scale.
|
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.
|
void |
renderPageToGraphics(int pageIndex,
Graphics2D graphics,
float scaleX,
float scaleY)
Renders a given page to an AWT Graphics2D instance.
|
void |
setAnnotationsFilter(AnnotationFilter annotationsFilter)
Set the AnnotationFilter.
|
void |
setSubsamplingAllowed(boolean subsamplingAllowed)
Sets a value instructing the renderer whether it is allowed to subsample images before
drawing.
|
protected final PDDocument document
public PDFRenderer(PDDocument document)
document
- the document to renderpublic AnnotationFilter getAnnotationsFilter()
public void setAnnotationsFilter(AnnotationFilter annotationsFilter)
Allows to only render annotation accepted by the filter.
annotationsFilter
- the AnnotationFilterpublic boolean isSubsamplingAllowed()
public void setSubsamplingAllowed(boolean subsamplingAllowed)
subsamplingAllowed
- The new value indicating if subsampling is allowed.public 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 readpublic void renderPageToGraphics(int pageIndex, Graphics2D graphics, float scaleX, float scaleY) throws IOException
pageIndex
- the zero-based index of the page to be convertedgraphics
- the Graphics2D on which to draw the pagescaleX
- the scale to draw the page at for the x-axisscaleY
- the scale to draw the page at for the y-axisIOException
- if the PDF cannot be readprotected PageDrawer createPageDrawer(PageDrawerParameters parameters) throws IOException
IOException
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.