iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference UIPrintPageRenderer Class Reference

Options
Deployment Target:

On This Page
Language:

UIPrintPageRenderer

A UIPrintPageRenderer object draws pages of content that are to be printed, with or without the assistance of print formatters. More...

Inheritance


Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 4.2 and later.
  • The number of pages to render.

    Declaration

    Swift

    func numberOfPages() -> Int

    Objective-C

    - (NSInteger)numberOfPages

    Discussion

    By default, returns the number of pages as calculated by UIKit if the receiver uses print formatters. If the page renderer uses no print formatters, the returned value is zero. If your page renderer is doing any custom drawing except for headers and footers, it must override this method.

    This method is called at any point when UIKit needs the number of pages. If an application requests the page range control, it's called early on. It can also be called when the selected printer or duplex mode changes. Otherwise, it is called when the print job starts.

    If print formatters aren’t used to compute the page count, the page renderer can override this method to calculate and return the number of pages. The computation can take into account the current printableRect value for each page, any implicit margins, and the content to be drawn when laid out within these boundaries.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    paperRect
    printableRect
    pageCount (UIPrintFormatter)

  • paperRect paperRect Property

    The size of the paper used for printing. (read-only)

    Declaration

    Swift

    var paperRect: CGRect { get }

    Objective-C

    @property(nonatomic, readonly) CGRect paperRect

    Discussion

    The value of this property is a rectangle that defines the size of paper chosen for the print job. The origin is always (0,0).

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    printableRect
    printPaper (UIPrintInteractionController)

  • The area in which printing can occur. (read-only)

    Declaration

    Swift

    var printableRect: CGRect { get }

    Objective-C

    @property(nonatomic, readonly) CGRect printableRect

    Discussion

    The value of this property is a rectangle that defines the area in which the printer can print content. Sometimes this is referred to as the imageable area of the paper.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    paperRect
    printPaper (UIPrintInteractionController)

  • The height of the page header.

    Declaration

    Swift

    var headerHeight: CGFloat

    Objective-C

    @property(nonatomic) CGFloat headerHeight

    Discussion

    The header is measured in points from the top of printableRect and is above the content area. The default header height is 0.0.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    footerHeight

  • The height of the page footer.

    Declaration

    Swift

    var footerHeight: CGFloat

    Objective-C

    @property(nonatomic) CGFloat footerHeight

    Discussion

    The footer is measured in points from the bottom of printableRect and is below the content area. The default footer height is 0.0

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.

    See Also

    headerHeight

  • Overridden by the page renderer to prepare for drawing a range of pages.

    Declaration

    Swift

    func prepareForDrawingPages(_ range: NSRange)

    Objective-C

    - (void)prepareForDrawingPages:(NSRange)range

    Parameters

    range

    A range of pages.

    Discussion

    UIKit calls this method before it requests drawing for a range of pages. You can optionally override this method to perform setup tasks. The default implementation does nothing.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later.