public final class PDFPrintable
extends java.lang.Object
implements java.awt.print.Printable
Modifier and Type | Field and Description |
---|---|
private boolean |
center |
private PDDocument |
document |
private float |
dpi |
private PDFRenderer |
renderer |
private java.awt.RenderingHints |
renderingHints |
private Scaling |
scaling |
private boolean |
showPageBorder |
private boolean |
subsamplingAllowed |
Constructor and Description |
---|
PDFPrintable(PDDocument document)
Creates a new PDFPrintable.
|
PDFPrintable(PDDocument document,
Scaling scaling)
Creates a new PDFPrintable with the given page scaling.
|
PDFPrintable(PDDocument document,
Scaling scaling,
boolean showPageBorder)
Creates a new PDFPrintable with the given page scaling and with optional page borders shown.
|
PDFPrintable(PDDocument document,
Scaling scaling,
boolean showPageBorder,
float dpi)
Creates a new PDFPrintable with the given page scaling and with optional page borders shown.
|
PDFPrintable(PDDocument document,
Scaling scaling,
boolean showPageBorder,
float dpi,
boolean center)
Creates a new PDFPrintable with the given page scaling and with optional page borders shown.
|
Modifier and Type | Method and Description |
---|---|
java.awt.RenderingHints |
getRenderingHints()
Get the rendering hints.
|
(package private) static PDRectangle |
getRotatedCropBox(PDPage page)
This will find the CropBox with rotation applied, for this page by looking up the hierarchy
until it finds them.
|
(package private) static PDRectangle |
getRotatedMediaBox(PDPage page)
This will find the MediaBox with rotation applied, for this page by looking up the hierarchy
until it finds them.
|
boolean |
isSubsamplingAllowed()
Value indicating if the renderer is allowed to subsample images before drawing, according to
image dimensions and requested scale.
|
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
void |
setRenderingHints(java.awt.RenderingHints renderingHints)
Set the rendering hints.
|
void |
setSubsamplingAllowed(boolean subsamplingAllowed)
Sets a value instructing the renderer whether it is allowed to subsample images before
drawing.
|
private final PDDocument document
private final PDFRenderer renderer
private final boolean showPageBorder
private final Scaling scaling
private final float dpi
private final boolean center
private boolean subsamplingAllowed
private java.awt.RenderingHints renderingHints
public PDFPrintable(PDDocument document)
document
- the document to printpublic PDFPrintable(PDDocument document, Scaling scaling)
document
- the document to printscaling
- page scaling policypublic PDFPrintable(PDDocument document, Scaling scaling, boolean showPageBorder)
document
- the document to printscaling
- page scaling policyshowPageBorder
- true if page borders are to be printedpublic PDFPrintable(PDDocument document, Scaling scaling, boolean showPageBorder, float dpi)
document
- the document to printscaling
- page scaling policyshowPageBorder
- true if page borders are to be printeddpi
- if non-zero then the image will be rasterized at the given DPIpublic PDFPrintable(PDDocument document, Scaling scaling, boolean showPageBorder, float dpi, boolean center)
document
- the document to printscaling
- page scaling policyshowPageBorder
- true if page borders are to be printeddpi
- if non-zero then the image will be rasterized at the given DPIcenter
- true if the content is to be centered on the page (otherwise top-left).public boolean isSubsamplingAllowed()
public void setSubsamplingAllowed(boolean subsamplingAllowed)
subsamplingAllowed
- The new value indicating if subsampling is allowed.public java.awt.RenderingHints getRenderingHints()
public void setRenderingHints(java.awt.RenderingHints renderingHints)
renderingHints
- public int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
java.awt.print.PrinterException
static PDRectangle getRotatedCropBox(PDPage page)
static PDRectangle getRotatedMediaBox(PDPage page)