---
title: UIPrintFormatter
framework: uikit
role: symbol
role_heading: Class
path: uikit/uiprintformatter
---

# UIPrintFormatter

An abstract base class for print formatters, which are objects that lay out custom printable content that can cross page boundaries.

## Declaration

```swift
class UIPrintFormatter
```

## Overview

Overview Given a print formatter, the printing system can automate the printing of the type of content associated with the print formatter. Examples of such content could be a web view, a mix of images and text, or a long text document. The UIKit framework provides several concrete subclasses of UIPrintFormatter: UISimpleTextPrintFormatter, UIMarkupTextPrintFormatter, and UIViewPrintFormatter. You can assign a single print formatter for a print job using the printFormatter property of the UIPrintInteractionController shared instance; or you can specify one or more print formatters that are associated with specific pages of a page renderer through the addPrintFormatter(_:startingAtPageAt:)method of UIPrintPageRenderer. A page renderer is an instance of a custom subclass of UIPrintPageRenderer that draws content for printing. UIPrintFormatter publishes an interface that allows you to specify the starting page for a print job and the margins around the printed content; given that information plus the content, a print formatter computes the number of pages for the print job. The following image depicts the print-formatter properties, along with certain UIPrintPaper and UIPrintPageRenderer properties, that define the layout of a multipage print job.

Third-party subclasses of UIPrintFormatter aren’t recommended. If you have custom content to print, use a custom UIPrintPageRenderer object.

## Topics

### Laying out the content

- [perPageContentInsets](uikit/uiprintformatter/perpagecontentinsets.md)
- [maximumContentHeight](uikit/uiprintformatter/maximumcontentheight.md)
- [maximumContentWidth](uikit/uiprintformatter/maximumcontentwidth.md)
- [contentInsets](uikit/uiprintformatter/contentinsets.md)

### Managing pagination

- [startPage](uikit/uiprintformatter/startpage.md)
- [pageCount](uikit/uiprintformatter/pagecount.md)

### Drawing the content

- [draw(in:forPageAt:)](uikit/uiprintformatter/draw(in:forpageat:).md)
- [rectForPage(at:)](uikit/uiprintformatter/rectforpage(at:).md)

### Communicating with the page renderer

- [removeFromPrintPageRenderer()](uikit/uiprintformatter/removefromprintpagerenderer().md)
- [printPageRenderer](uikit/uiprintformatter/printpagerenderer.md)

### Requiring operations to take place on the main thread

- [requiresMainThread](uikit/uiprintformatter/requiresmainthread.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [UIMarkupTextPrintFormatter](uikit/uimarkuptextprintformatter.md)
- [UISimpleTextPrintFormatter](uikit/uisimpletextprintformatter.md)
- [UIViewPrintFormatter](uikit/uiviewprintformatter.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Formatters

- [UIViewPrintFormatter](uikit/uiviewprintformatter.md)
- [UISimpleTextPrintFormatter](uikit/uisimpletextprintformatter.md)
- [UIMarkupTextPrintFormatter](uikit/uimarkuptextprintformatter.md)
