public class PDFRenderer
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
protected PDDocument |
document |
| Constructor | Description |
|---|---|
PDFRenderer(PDDocument document) |
Creates a new PDFRenderer.
|
| Modifier and Type | Method | 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.
|
java.awt.image.BufferedImage |
renderImage(int pageIndex) |
Returns the given page as an RGB image at 72 DPI
|
java.awt.image.BufferedImage |
renderImage(int pageIndex,
float scale) |
Returns the given page as an RGB image at the given scale.
|
java.awt.image.BufferedImage |
renderImage(int pageIndex,
float scale,
ImageType imageType) |
Returns the given page as an RGB or ARGB image at the given scale.
|
java.awt.image.BufferedImage |
renderImageWithDPI(int pageIndex,
float dpi) |
Returns the given page as an RGB image at the given DPI.
|
java.awt.image.BufferedImage |
renderImageWithDPI(int pageIndex,
float dpi,
ImageType imageType) |
Returns the given page as an RGB image at the given DPI.
|
void |
renderPageToGraphics(int pageIndex,
java.awt.Graphics2D graphics) |
Renders a given page to an AWT Graphics2D instance.
|
void |
renderPageToGraphics(int pageIndex,
java.awt.Graphics2D graphics,
float scale) |
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 java.awt.image.BufferedImage renderImage(int pageIndex)
throws java.io.IOException
pageIndex - the zero-based index of the page to be converted.java.io.IOException - if the PDF cannot be readpublic java.awt.image.BufferedImage renderImage(int pageIndex,
float scale)
throws java.io.IOException
pageIndex - the zero-based index of the page to be convertedscale - the scaling factor, where 1 = 72 DPIjava.io.IOException - if the PDF cannot be readpublic java.awt.image.BufferedImage renderImageWithDPI(int pageIndex,
float dpi)
throws java.io.IOException
pageIndex - the zero-based index of the page to be converteddpi - the DPI (dots per inch) to render atjava.io.IOException - if the PDF cannot be readpublic java.awt.image.BufferedImage renderImageWithDPI(int pageIndex,
float dpi,
ImageType imageType)
throws java.io.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 returnjava.io.IOException - if the PDF cannot be readpublic java.awt.image.BufferedImage renderImage(int pageIndex,
float scale,
ImageType imageType)
throws java.io.IOException
pageIndex - the zero-based index of the page to be convertedscale - the scaling factor, where 1 = 72 DPIimageType - the type of image to returnjava.io.IOException - if the PDF cannot be readpublic void renderPageToGraphics(int pageIndex,
java.awt.Graphics2D graphics)
throws java.io.IOException
pageIndex - the zero-based index of the page to be convertedgraphics - the Graphics2D on which to draw the pagejava.io.IOException - if the PDF cannot be readpublic void renderPageToGraphics(int pageIndex,
java.awt.Graphics2D graphics,
float scale)
throws java.io.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 atjava.io.IOException - if the PDF cannot be readprotected PageDrawer createPageDrawer(PageDrawerParameters parameters) throws java.io.IOException
java.io.IOExceptionCopyright © 2002–2018. All rights reserved.