Contents

UIPrintInteractionController

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

Declaration

@MainActor class UIPrintInteractionController

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 print 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 print:

  • 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 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 app’s user interface, a controller object of the app should respond to the action message by obtaining the shared instance of UIPrintInteractionController and preparing it for the print job. When the app calls one of the present... methods (for example, present(animated: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.

For design guidance, see Human Interface Guidelines.

Topics

Getting the shared controller instance

Assigning the delegate

Determining printability

Providing the source of printable content

Presenting the printing user interface

Printing directly to a printer

Accessing print-job information

Handling printing errors

See Also

Print panels