iOS Developer Library

Developer

UIKit Framework Reference UIPrintInteractionControllerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

UIPrintInteractionControllerDelegate

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.

Inheritance


Not Applicable

Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 4.2 and later.
  • Asks the delegate for an object encapsulating the paper size and printing area to use for the print job.

    Declaration

    Swift

    optional func printInteractionController(_ printInteractionController: UIPrintInteractionController, choosePaper paperList: [AnyObject]) -> UIPrintPaper?

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    printPaper (UIPrintInteractionController)

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

    Declaration

    Swift

    optional func printInteractionController(_ printInteractionController: UIPrintInteractionController, cutLengthForPaper paper: UIPrintPaper) -> CGFloat

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 7.0 and later.