Package org.apache.pdfbox.printing
Class PDFPageable
- java.lang.Object
-
- java.awt.print.Book
-
- org.apache.pdfbox.printing.PDFPageable
-
- All Implemented Interfaces:
java.awt.print.Pageable
public final class PDFPageable extends java.awt.print.BookPrints a PDF document using its original paper size.- Author:
- John Hewson
-
-
Constructor Summary
Constructors Constructor Description PDFPageable(PDDocument document)Creates a new PDFPageable.PDFPageable(PDDocument document, Orientation orientation)Creates a new PDFPageable with the given page orientation.PDFPageable(PDDocument document, Orientation orientation, boolean showPageBorder)Creates a new PDFPageable with the given page orientation and with optional page borders shown.PDFPageable(PDDocument document, Orientation orientation, boolean showPageBorder, float dpi)Creates a new PDFPageable with the given page orientation and with optional page borders shown.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumberOfPages()java.awt.print.PageFormatgetPageFormat(int pageIndex)Returns the actual physical size of the pages in the PDF file.java.awt.print.PrintablegetPrintable(int i)
-
-
-
Constructor Detail
-
PDFPageable
public PDFPageable(PDDocument document)
Creates a new PDFPageable.- Parameters:
document- the document to print
-
PDFPageable
public PDFPageable(PDDocument document, Orientation orientation)
Creates a new PDFPageable with the given page orientation.- Parameters:
document- the document to printorientation- page orientation policy
-
PDFPageable
public PDFPageable(PDDocument document, Orientation orientation, boolean showPageBorder)
Creates a new PDFPageable with the given page orientation and with optional page borders shown. The image will be rasterized at the given DPI before being sent to the printer.- Parameters:
document- the document to printorientation- page orientation policyshowPageBorder- true if page borders are to be printed
-
PDFPageable
public PDFPageable(PDDocument document, Orientation orientation, boolean showPageBorder, float dpi)
Creates a new PDFPageable with the given page orientation and with optional page borders shown. The image will be rasterized at the given DPI before being sent to the printer.- Parameters:
document- the document to printorientation- page orientation policyshowPageBorder- true if page borders are to be printeddpi- if non-zero then the image will be rasterized at the given DPI
-
-
Method Detail
-
getNumberOfPages
public int getNumberOfPages()
- Specified by:
getNumberOfPagesin interfacejava.awt.print.Pageable- Overrides:
getNumberOfPagesin classjava.awt.print.Book
-
getPageFormat
public java.awt.print.PageFormat getPageFormat(int pageIndex)
Returns the actual physical size of the pages in the PDF file. May not fit the local printer.- Specified by:
getPageFormatin interfacejava.awt.print.Pageable- Overrides:
getPageFormatin classjava.awt.print.Book
-
getPrintable
public java.awt.print.Printable getPrintable(int i)
- Specified by:
getPrintablein interfacejava.awt.print.Pageable- Overrides:
getPrintablein classjava.awt.print.Book
-
-