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

# UIPrintFormatter

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

```
class UIPrintFormatter
```

## 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`](/documentation/UIKit/UIPrintFormatter): [`UISimpleTextPrintFormatter`](/documentation/UIKit/UISimpleTextPrintFormatter), [`UIMarkupTextPrintFormatter`](/documentation/UIKit/UIMarkupTextPrintFormatter), and [`UIViewPrintFormatter`](/documentation/UIKit/UIViewPrintFormatter).

You can assign a single print formatter for a print job using the [`printFormatter`](/documentation/UIKit/UIPrintInteractionController/printFormatter) property of the [`UIPrintInteractionController`](/documentation/UIKit/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:)`](/documentation/UIKit/UIPrintPageRenderer/addPrintFormatter(_:startingAtPageAt:))method of [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer). A page renderer is an instance of a custom subclass of [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) that draws content for printing.

[`UIPrintFormatter`](/documentation/UIKit/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`](/documentation/UIKit/UIPrintPaper) and [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) properties, that define the layout of a multipage print job.

![Diagram that shows the layout of printed content.](images/com.apple.uikit/media-1965769.jpg)

Third-party subclasses of [`UIPrintFormatter`](/documentation/UIKit/UIPrintFormatter) aren’t recommended. If you have custom content to print, use a custom [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) object.

## Topics

### Laying out the content

[`perPageContentInsets`](/documentation/UIKit/UIPrintFormatter/perPageContentInsets)

The margins for each printed page.

[`maximumContentHeight`](/documentation/UIKit/UIPrintFormatter/maximumContentHeight)

The maximum height of the content area.

[`maximumContentWidth`](/documentation/UIKit/UIPrintFormatter/maximumContentWidth)

The maximum width of the content area.

[`contentInsets`](/documentation/UIKit/UIPrintFormatter/contentInsets)

The distances the edges of content are inset from the printing rectangle.

### Managing pagination

[`startPage`](/documentation/UIKit/UIPrintFormatter/startPage)

The index of the first page that the print formatter lays out.

[`pageCount`](/documentation/UIKit/UIPrintFormatter/pageCount)

The number of pages to print.

### Drawing the content

[`draw(in:forPageAt:)`](/documentation/UIKit/UIPrintFormatter/draw(in:forPageAt:))

Draws the portion of a print formatter’s content for the specified area of the specified page.

[`rectForPage(at:)`](/documentation/UIKit/UIPrintFormatter/rectForPage(at:))

Returns the area that encloses a specified page of content.

### Communicating with the page renderer

[`removeFromPrintPageRenderer()`](/documentation/UIKit/UIPrintFormatter/removeFromPrintPageRenderer())

Removes the print formatter from the page renderer.

[`printPageRenderer`](/documentation/UIKit/UIPrintFormatter/printPageRenderer)

Returns the page renderer for the print formatter.

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

[`requiresMainThread`](/documentation/UIKit/UIPrintFormatter/requiresMainThread)

A Boolean value that determines whether the system executes the print formatter’s rendering operations on the main thread.



---

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)