<!--
{
  "availability" : [
    "iOS: 4.2.0 -",
    "iPadOS: 4.2.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPrintPageRenderer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPrintPageRenderer"
  },
  "title" : "UIPrintPageRenderer"
}
-->

# UIPrintPageRenderer

An object that draws pages of content to print, with or without the assistance of print formatters.

```
class UIPrintPageRenderer
```

## Overview

A page renderer is an instance of a custom subclass of [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer). When you compose a print job using the shared instance of [`UIPrintInteractionController`](/documentation/UIKit/UIPrintInteractionController), you assign the page renderer to the [`printPageRenderer`](/documentation/UIKit/UIPrintInteractionController/printPageRenderer) property of that instance. The subclass typically overrides one or more of the five `draw...` methods.

The [`drawPage(at:in:)`](/documentation/UIKit/UIPrintPageRenderer/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:)`](/documentation/UIKit/UIPrintPageRenderer/drawHeaderForPage(at:in:)) to draw content in the header.
- Override [`drawContentForPage(at:in:)`](/documentation/UIKit/UIPrintPageRenderer/drawContentForPage(at:in:)) to draw the main content of the print job in the area between the header and the footer.
- Override [`drawPrintFormatter(_:forPageAt:)`](/documentation/UIKit/UIPrintPageRenderer/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:)`](/documentation/UIKit/UIPrintPageRenderer/drawFooterForPage(at:in:)) to draw content in the footer.

[`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) usually requires you to specify the number of pages of printable content by overriding [`numberOfPages`](/documentation/UIKit/UIPrintPageRenderer/numberOfPages). It also allows you to specify the heights of page headers and footers.

You may assign one or more print formatters — [`UIPrintFormatter`](/documentation/UIKit/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`](/documentation/UIKit/UIMarkupTextPrintFormatter) object to the starting page of HTML content. You assign a print formatter using the [`addPrintFormatter(_:startingAtPageAt:)`](/documentation/UIKit/UIPrintPageRenderer/addPrintFormatter(_:startingAtPageAt:)) method and you can get the print formatters for a particular page by calling [`printFormattersForPage(at:)`](/documentation/UIKit/UIPrintPageRenderer/printFormattersForPage(at:)).

## Topics

### Accessing information about the print job

[`var numberOfPages: Int`](/documentation/UIKit/UIPrintPageRenderer/numberOfPages)

The number of pages to render.

[`var paperRect: CGRect`](/documentation/UIKit/UIPrintPageRenderer/paperRect)

The size of the paper for printing.

[`var printableRect: CGRect`](/documentation/UIKit/UIPrintPageRenderer/printableRect)

The area in which printing can occur.

### Specifying header and footer heights

[`var headerHeight: CGFloat`](/documentation/UIKit/UIPrintPageRenderer/headerHeight)

The height of the page header.

[`var footerHeight: CGFloat`](/documentation/UIKit/UIPrintPageRenderer/footerHeight)

The height of the page footer.

### Managing print formatters

[`func addPrintFormatter(UIPrintFormatter, startingAtPageAt: Int)`](/documentation/UIKit/UIPrintPageRenderer/addPrintFormatter(_:startingAtPageAt:))

Adds a print formatter to the page renderer starting at the specified page.

[`func printFormattersForPage(at: Int) -> [UIPrintFormatter]?`](/documentation/UIKit/UIPrintPageRenderer/printFormattersForPage(at:))

Returns the print formatters for a specified page.

[`var printFormatters: [UIPrintFormatter]?`](/documentation/UIKit/UIPrintPageRenderer/printFormatters)

The print formatters for the page renderer.

### Preparing for drawing

[`func prepare(forDrawingPages: NSRange)`](/documentation/UIKit/UIPrintPageRenderer/prepare(forDrawingPages:))

Prepares the renderer for drawing a range of pages.

### Drawing a page

[`func drawPage(at: Int, in: CGRect)`](/documentation/UIKit/UIPrintPageRenderer/drawPage(at:in:))

Draws a page of content for the printer.

[`func drawHeaderForPage(at: Int, in: CGRect)`](/documentation/UIKit/UIPrintPageRenderer/drawHeaderForPage(at:in:))

Draws the header of a page.

[`func drawContentForPage(at: Int, in: CGRect)`](/documentation/UIKit/UIPrintPageRenderer/drawContentForPage(at:in:))

Draws the content of a page.

[`func drawPrintFormatter(UIPrintFormatter, forPageAt: Int)`](/documentation/UIKit/UIPrintPageRenderer/drawPrintFormatter(_:forPageAt:))

Performs custom drawing in addition to the specified print formatter’s drawing for a page.

[`func drawFooterForPage(at: Int, in: CGRect)`](/documentation/UIKit/UIPrintPageRenderer/drawFooterForPage(at:in:))

Draws the footer of a page.

### Managing the rendering quality

[`func currentRenderingQuality(forRequested: UIPrintRenderingQuality) -> UIPrintRenderingQuality`](/documentation/UIKit/UIPrintPageRenderer/currentRenderingQuality(forRequested:))

Determines the actual print-rendering quality according to the requested rendering quality.

[`enum UIPrintRenderingQuality`](/documentation/UIKit/UIPrintRenderingQuality)

Constants that represent the rendering quality for a print operation.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)