iOS Developer Library

Developer

UIKit Framework Reference UIMarkupTextPrintFormatter Class Reference

Options
Deployment Target:

On This Page
Language:

UIMarkupTextPrintFormatter

Inherits From


Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 4.2 and later

Instances of the UIMarkupTextPrintFormatter class lay out HTML markup text for a multipage print job.

To use this print formatter for a print job, create an instance of UIMarkupTextPrintFormatter initialized with the HTML, set the inherited layout properties, and add the object to the print job in one of two ways:

  • If a single print formatter is being used for the print job (with no additional drawing), assign it to the printFormatter property of the UIPrintInteractionController shared instance. The inherited startPage property identifies the beginning page of content with which the formatter is associated.

  • If you are using multiple formatters along with a page renderer, associate each print formatter with a starting page of the printed content. You often take this approach when you want to add content such as headers and footers to what the formatters provide. You have two ways of associating a print formatter with a UIPrintPageRenderer object:

    • You can add print formatters to the printFormatters property of the UIPrintPageRenderer object; the startPage property of the print formatter specifies the starting page.

    • You can add print formatters by calling addPrintFormatter:startingAtPageAtIndex: for each print formatter; the second parameter of this method specifies the starting page (and overrides any startPage value).

You can change the markup text at any time before the drawing of the printable content begins.

  • Returns a markup-text print formatter initialized with an HTML string.

    Declaration

    Swift

    init!(markupText markupText: String?)

    Objective-C

    - (instancetype)initWithMarkupText:(NSString *)markupText

    Parameters

    markupText

    A string of HTML markup text or nil if you want to add the markup text later.

    Return Value

    An instance of UIMarkupTextPrintFormatter or nil if the object could not be created.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later

    See Also

    markupText

  • The HTML markup text for the print formatter.

    Declaration

    Swift

    var markupText: String?

    Objective-C

    @property(nonatomic, copy) NSString *markupText

    Discussion

    When drawing begins for the print job, you cannot change the value of this property. The delegate method printInteractionControllerWillStartJob: is called immediately before the formatting is set for the job.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 4.2 and later