Chapter 30

Printing

Starting with iOS 4.2, applications can print their contents to local printers. Printing is a valuable feature that can be added to an existing application often with only a few lines of code. In this lesson, you learn to add printing capabilities to your apps.

From an end user’s perspective, printing from an iOS device involves tapping a print button, specifying a few print options, and sending a print job to the printer. A print job is a unit of work for the iOS printing subsystem, which includes not just the content to be printed, but also additional information such as the name of the printer, print quality settings, and page orientation.

The print options user interface is provided by UIKit. On an iPad it is a popover view; on an iPhone/iPod Touch it is a sheet that can be animated to slide up from the bottom of the screen (Figure 30-1).

The print options always include a list of printers that have been discovered, and the number of copies. Sometimes the user interface can include additional options such as the range of pages to print, and duplex printing.

The printing subsystem is shared between all applications; print jobs are sent to the printer in the order in which they are received. After submitting a print job from an application, the user can monitor its status by double-tapping the home button and using the standard Print Center ...

Get iPhone and iPad App 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.