Provides classes for implementing print support in applications and also contains all base classes and abstractions involved in printing. These base classes are also used by other more specialized printing related packages.
The entry point for interacting with the print system is the
PrintManager
which is a system service that can be obtained from the current context. The print manager
provides APIs for printing, querying the state of print jobs, etc.
An application that wants to implement printing must extend
PrintDocumentAdapter
which defines the contract between the system
and the application.The key idea behind this adapter is that the printed content may change
based on the selected print options, such as media size, orientation, which
requires the content to be re-laid out. The constraints according to which the content has
to be laid out are encapsulated in the
PrintAttributes
class. Once
layout is completed the application calls back to the system passing a
PrintDocumentInfo
instance which describes the generated content. After
the content has been laid out the application may be asked to render some pages of that content
for preview or printing. The range of pages that have to be rendered is abstracted by the
PageRange
class.
A print job is represented by the
PrintJob
class which has behavior
methods as well as methods for querying its state. Each print job has a unique id represented
by the
PrintJobId
class and exposes APIs for obtaining a
PrintJobInfo
which is a snapshot of its state. The print job state may
change over time.
An available printer represented by the
PrinterInfo
class has a
unique id which is abstracted by the
PrinterId
class. The
PrinterInfo
contains printer properties such as id, name, description, status,
and printer capabilities encapsulated in the
PrinterCapabilitiesInfo
class. Printer capabilities describe how a printer can print content, for example what are
the supported media sizes, color modes, resolutions, etc.
PageRange | Represents a range of pages. |
PrintAttributes | This class represents the attributes of a print job. |
PrintAttributes.Builder |
Builder for creating
PrintAttributes
.
|
PrintAttributes.Margins | This class specifies content margins. |
PrintAttributes.MediaSize | This class specifies a supported media size. |
PrintAttributes.Resolution | This class specifies a supported resolution in DPI (dots per inch). |
PrintDocumentAdapter | Base class that provides the content of a document to be printed. |
PrintDocumentAdapter.LayoutResultCallback |
Base class for implementing a callback for the result of
onLayout(PrintAttributes, PrintAttributes, CancellationSignal, LayoutResultCallback, Bundle)
.
|
PrintDocumentAdapter.WriteResultCallback |
Base class for implementing a callback for the result of
onWrite(PageRange[], ParcelFileDescriptor, CancellationSignal, WriteResultCallback)
.
|
PrintDocumentInfo | This class encapsulates information about a document for printing purposes. |
PrintDocumentInfo.Builder |
Builder for creating a
PrintDocumentInfo
.
|
PrinterCapabilitiesInfo | This class represents the capabilities of a printer. |
PrinterCapabilitiesInfo.Builder |
Builder for creating of a
PrinterCapabilitiesInfo
.
|
PrinterId | This class represents the unique id of a printer. |
PrinterInfo | This class represents the description of a printer. |
PrinterInfo.Builder |
Builder for creating of a
PrinterInfo
.
|
PrintJob | This class represents a print job from the perspective of an application. |
PrintJobId | This class represents the id of a print job. |
PrintJobInfo | This class represents the description of a print job. |
PrintJobInfo.Builder |
Builder for creating a
PrintJobInfo
.
|
PrintManager | System level service for accessing the printing capabilities of the platform. |