UIPrint object draws pages of content that are to be printed, with or without the assistance of print formatters.
- iOS 4.2+
A page renderer is an instance of a custom subclass of
UIPrint. When you compose a print job using the shared instance of
UIPrint, you assign the page renderer to the
drawby default calls each of the other draw methods, in the order listed below. Your application can override it if you want to have complete control over what is drawn for printing.
drawto draw content in the header.
Header For Page(at: in:)
drawto draw the main content of the print job in the area between the header and the footer.
Content For Page(at: in:)
drawto intermix custom drawing with the drawing performed by an associated print formatter. This method is called for each print formatter associated with a given page.
Formatter(_: for Page At:)
drawto draw content in the footer.
Footer For Page(at: in:)
UIPrint usually requires you to specify the number of pages of printable content by overriding
number. It also allows you to specify the heights of page headers and footers.
You may assign one or more print formatters—that is,
UIPrint objects that can lay out printable content of a certain kind—to specific page ranges of the content. For example, if your printable content is partially HTML, you may assign an instance of the
UIMarkup object to the starting page of HTML content. You assign a print formatter using the
add method and you can get the print formatters for a given page by calling