org.apache.pdfbox.printing

## Class PDFPageable

- java.lang.Object
- - java.awt.print.Book
  - - org.apache.pdfbox.printing.PDFPageable

All Implemented Interfaces:
  Pageable

    public final class PDFPageable
    extends Book

Prints a PDF document using its original paper size.

Author:
  John Hewson

### Field Summary

### Fields inherited from interface java.awt.print.Pageable

`UNKNOWN_NUMBER_OF_PAGES`

### Constructor Summary

Constructors
Constructor and 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.
`PDFPageable(PDDocument document, Orientation orientation, boolean showPageBorder, float dpi, boolean center)` Creates a new PDFPageable with the given page orientation and with optional page borders shown.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getNumberOfPages()`
`PageFormat` `getPageFormat(int pageIndex)` Returns the actual physical size of the pages in the PDF file.
`Printable` `getPrintable(int i)`
`RenderingHints` `getRenderingHints()` Get the rendering hints.
`boolean` `isSubsamplingAllowed()` Value indicating if the renderer is allowed to subsample images before drawing, according to image dimensions and requested scale.
`void` `setRenderingHints(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.

### Methods inherited from class java.awt.print.Book

`append, append, setPage`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 print
  `orientation` - 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.

Parameters:
  `document` - the document to print
  `orientation` - page orientation policy
  `showPageBorder` - 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 if non-zero.

Parameters:
  `document` - the document to print
  `orientation` - page orientation policy
  `showPageBorder` - true if page borders are to be printed
  `dpi` - if non-zero then the image will be rasterized at the given DPI

#### PDFPageable

    public PDFPageable(PDDocument document,
                       Orientation orientation,
                       boolean showPageBorder,
                       float dpi,
                       boolean center)

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 if non-zero, and optionally be centered.

Parameters:
  `document` - the document to print
  `orientation` - page orientation policy
  `showPageBorder` - true if page borders are to be printed
  `dpi` - if non-zero then the image will be rasterized at the given DPI
  `center` - true if the content is to be centered on the page (otherwise top-left).

### Method Detail

#### getRenderingHints

    public RenderingHints getRenderingHints()

Get the rendering hints.

Returns:
  the rendering hints or null if none are set.

#### setRenderingHints

    public void setRenderingHints(RenderingHints renderingHints)

Set the rendering hints. Use this to influence rendering quality and speed. If you don't set them yourself or pass null, PDFBox will decide at runtime depending on the destination.

Parameters:
  `renderingHints` - rendering hints to be used to influence rendering quality and speed

#### isSubsamplingAllowed

    public boolean isSubsamplingAllowed()

Value indicating if the renderer is allowed to subsample images before drawing, according to image dimensions and requested scale. Subsampling may be faster and less memory-intensive in some cases, but it may also lead to loss of quality, especially in images with high spatial frequency.

Returns:
  true if subsampling of images is allowed, false otherwise.

#### setSubsamplingAllowed

    public void setSubsamplingAllowed(boolean subsamplingAllowed)

Sets a value instructing the renderer whether it is allowed to subsample images before drawing. The subsampling frequency is determined according to image size and requested scale. Subsampling may be faster and less memory-intensive in some cases, but it may also lead to loss of quality, especially in images with high spatial frequency.

Parameters:
  `subsamplingAllowed` - The new value indicating if subsampling is allowed.

#### getNumberOfPages

    public int getNumberOfPages()

Specified by:
  `getNumberOfPages` in interface `Pageable`
Overrides:
  `getNumberOfPages` in class `Book`

#### getPageFormat

    public PageFormat getPageFormat(int pageIndex)

Returns the actual physical size of the pages in the PDF file. May not fit the local printer.

Specified by:
  `getPageFormat` in interface `Pageable`
Overrides:
  `getPageFormat` in class `Book`

#### getPrintable

    public Printable getPrintable(int i)

Specified by:
  `getPrintable` in interface `Pageable`
Overrides:
  `getPrintable` in class `Book`