UIPrintInteractionControllerDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 4.2 and later.
Companion guide
Declared in
UIPrintInteractionController.h

Overview

The UIPrintInteractionControllerDelegate protocol is implemented by the delegate of the UIPrintInteractionController shared instance to perform a number of optional tasks.

If the application has special requirements for content sizes, it can implement printInteractionController:choosePaper: to return a UIPrintPaper object encapsulating the page size and the printing area to use for a print job. If you want more control of the presentation of the printing options, the delegate can return a view controller that owns the printing-options view in an implementation of printInteractionControllerParentViewController:. The delegate can also implement methods that are invoked when the printing user interface is presented and when it is dismissed, and when the print job begins and ends.

Tasks

Returning a Parent View Controller

Choosing a Paper Size for the Print Job

Responding to the Presentation and Dismissal of the Printing Interface

Responding to the Start and End of a Print Job

Instance Methods

printInteractionController:choosePaper:

Asks the delegate for an object encapsulating the paper size and printing area to use for the print job.

- (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray *)paperList
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

paperList

An array of UIPrintPaper objects that represent combinations of paper sizes and imageable areas supported by the selected printer.

Return Value

A UIPrintPaper object representing both the paper size and imageable area (or printable rectangle) to use for the print job. If you return nil, a UIPrintPaper encapsulating the default paper size and printable rectangle is used.

Discussion

This method is intended for applications (typically document-based) that have a notion of distinct paper sizes. The delegate can examine the objects in paperList to locate the paper size and printable rectangle combination that is best suited for its needs and return the encapsulating UIPrintPaper object. Or it can call the bestPaperForPageSize:withPapersFromArray: class method of the UIPrintPaper class, passing in a specific page size (typically the document size), and return the object returned by that method.

Availability
  • Available in iOS 4.2 and later.
See Also
Declared In
UIPrintInteractionController.h

printInteractionController:cutLengthForPaper:

Asks the delegate for a length to use when cutting the page.

- (CGFloat)printInteractionController:(UIPrintInteractionController *)printInteractionController cutLengthForPaper:(UIPrintPaper *)paper
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

paper

A UIPrintPaper that specifies the maximum physical and printable areas of the page.

Return Value

The physiucal length of the page in points.

Discussion

Some printers can cut a roll of print paper at a particular length. If you implement this method in your delegate, then it may be called during a print job. Your delegate should determine the length in which the content fits and return this value. When printed, the paper will be cut to this length.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerDidDismissPrinterOptions:

Tells the delegate that the printer user interface is being dismissed.

- (void)printInteractionControllerDidDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Discussion

This message is sent both when the user taps Print on the printing-options view and when the user dismisses the view by tapping outside it.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerDidFinishJob:

Tells the delegate that the print job has ended.

- (void)printInteractionControllerDidFinishJob:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Discussion

You can implement this method to do clean-up tasks related to the print job. This method is called after the last page of the print job is generated but before the completion handler (a block handler of type UIPrintInteractionCompletionHandler) is called.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerDidPresentPrinterOptions:

Tells the delegate that the printing-options user interface has just been presented.

- (void)printInteractionControllerDidPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerParentViewController:

Returns a parent view controller for managing the printing-options view.

- (UIViewController *)printInteractionControllerParentViewController:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Return Value

The view controller that is to be the parent of the print-interaction controller managing the printing-options view. Return nil for the standard presentation behavior.

Discussion

This method allows an application to present the print-options view from a view controller of their own choosing. The parent view controller returned must be a UIViewController object, such as a UINavigationController object or a generic view controller. A common strategy for embedding is to create a UINavigationController object as the content view controller (contentViewController property) of a UIPopoverController object and return that. UIKit can push the returned view controller onto the stack if its parent is a navigation controller or present it modally if it isn’t.

This method is invoked in any of the present... methods of the UIPrintInteractionController class (for example, presentAnimated:completionHandler:).

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerWillDismissPrinterOptions:

Tells the delegate that the printing-options user interface will be dismissed.

- (void)printInteractionControllerWillDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerWillPresentPrinterOptions:

Tells the delegate that the printing-options user interface is about to be displayed.

- (void)printInteractionControllerWillPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h

printInteractionControllerWillStartJob:

Tells the delegate that the print job is about to start.

- (void)printInteractionControllerWillStartJob:(UIPrintInteractionController *)printInteractionController
Parameters
printInteractionController

The shared instance of UIPrintInteractionController that is managing the print job.

Discussion

You can implement this method to do set-up tasks related to the print job. For example, an application that needs to do intensive rendering could implement this method to pause animations. This method is called before drawing begins but after the printing user interface is dismissed.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInteractionController.h