UIPrintPageRenderer
An object that draws pages of content to print, with or without the assistance of print formatters.
Declaration
class UIPrintPageRendererOverview
A page renderer is an instance of a custom subclass of UIPrintPageRenderer. When you compose a print job using the shared instance of UIPrintInteractionController, you assign the page renderer to the printPageRenderer property of that instance. The subclass typically overrides one or more of the five draw... methods.
The drawPage(at:in:) by default calls each of the other draw methods, in the order listed below. Your app can override it if you want to have complete control over what to draw for printing.
Override drawHeaderForPage(at:in:) to draw content in the header.
Override drawContentForPage(at:in:) to draw the main content of the print job in the area between the header and the footer.
Override drawPrintFormatter(_:forPageAt:) to intermix custom drawing with the drawing that an associated print formatter performs. The system calls this method for each print formatter associated with a particular page.
Override drawFooterForPage(at:in:) to draw content in the footer.
UIPrintPageRenderer usually requires you to specify the number of pages of printable content by overriding numberOfPages. It also allows you to specify the heights of page headers and footers.
You may assign one or more print formatters — UIPrintFormatter 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 UIMarkupTextPrintFormatter object to the starting page of HTML content. You assign a print formatter using the addPrintFormatter(_:startingAtPageAt:) method and you can get the print formatters for a particular page by calling printFormattersForPage(at:).
Topics
Accessing information about the print job
Specifying header and footer heights
Managing print formatters
Preparing for drawing
Drawing a page
drawPage(at:in:)drawHeaderForPage(at:in:)drawContentForPage(at:in:)drawPrintFormatter(_:forPageAt:)drawFooterForPage(at:in:)