Class

UIPrintInteractionController

A printing user interface that manages the printing of documents, images, and other printable content in iOS.

Declaration

@interface UIPrintInteractionController : NSObject

Overview

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:

  • printingItem takes a single print-ready object.

  • printingItems takes an array of print-ready objects.

  • printFormatter takes a print formatter, an object that knows how to lay out content of a certain type.

  • printPageRenderer takes a page renderer, a custom object that draws the content for printing.

If the showsPageRange property is set to YES, 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, presentAnimated:completionHandler:), 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.

Topics

Getting the Shared Controller Instance

sharedPrintController

Returns the shared print-interaction controller object.

Assigning the Delegate

delegate

The delegate of the print interaction controller.

UIPrintInteractionControllerDelegate

A set of methods implemented by the delegate of the UIPrintInteractionController shared instance to perform a number of optional tasks.

Determining Printability

printingAvailable

Returns a Boolean indicating whether the device supports printing.

+ canPrintData:

Returns whether UIKit can print the contents of a data object.

+ canPrintURL:

Returns whether UIKit can print the file referenced by a URL.

printableUTIs

Returns a set of the Uniform Type Identifiers for the types of data that UIKit can print.

Providing the Source of Printable Content

printingItem

A single ready-to-print object.

printingItems

An array of ready-to-print objects.

printPageRenderer

An object that draws pages of printable content when requested by UIKit.

printFormatter

An object that lays out the content of pages based on the kind of content.

Presenting the Printing User Interface

- presentAnimated:completionHandler:

Presents the iPhone printing user interface in a sheet that can be animated to slide up from the bottom of the screen.

- presentFromBarButtonItem:animated:completionHandler:

Presents the iPad printing user interface in a popover view that can be animated from a bar-button item.

- presentFromRect:inView:animated:completionHandler:

Presents the iPad printing user interface in a popover view that can be animated from any area in a view.

- dismissAnimated:

Dismisses the printing-options sheet or popover.

Printing Directly to a Printer

- printToPrinter:completionHandler:

Print directly to the specified printer.

UIPrintInteractionCompletionHandler

The type of block callback for responding to the completion of a print job or handing printing errors.

Accessing Print-Job Information

printInfo

An object encapsulating information about the print job.

printPaper

An object representing the paper size and printing area for the print job.

showsNumberOfCopies

A Boolean value that determines whether the printing options include the number of copies.

showsPageRange

A Boolean value that determines whether the printing options include a page-range control.

Deprecated
showsPaperSelectionForLoadedPapers

A Boolean value for enabling the paper selection menu.

Printing Errors

UIPrintErrorDomain

The string constant defining the UIKit printing error domain.

Relationships

Inherits From

See Also

Print Panels

UIPrinterPickerController

A view controller that displays the standard interface for selecting a printer.