The shared instance of the
UIPrintInteractionController class presents a printing user interface and manages the printing of documents, images, and other printable content in iOS.
- iOS 4.2+
UIPrintInteractionController is the central class for printing in iOS. The shared instance of it represents a print job. A print job includes the content to be printed and information and options related to its printing, such as output type, job name, paper size, and orientation.
UIPrintInteractionController has four mutually exclusive properties for giving it the content to be printed:
printingItemtakes a single print-ready object.
printingItemstakes an array of print-ready objects.
printFormattertakes a print formatter, an object that knows how to lay out content of a certain type.
printPageRenderertakes a page renderer, a custom object that draws the content for printing.
showsPageRange property is set to
true, the number of pages is more than 1, and you assign an object to any of these properties except for the
printingItems property, the printing options include a control that allows users to select a page range.
When users tap a print button on the application’s user interface, a controller object of the application should respond to the action message by obtaining the shared instance of
UIPrintInteractionController and preparing it for the print job. When the application calls one of the
present... methods (for example,
UIPrintInteractionController displays a view containing printing options. This interface is simple, allowing users to select a printer, specify the number of copies and possibly a range of pages, and choose single-sided or double-sided printing (if the printer supports duplex printing). When users make their selections and tap Print, the print job begins.