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

# UIMarkupTextPrintFormatter

An object that lays out HTML text for a multipage print job.

```
class UIMarkupTextPrintFormatter
```

## Overview

To use this print formatter for a print job, create an instance of [`UIMarkupTextPrintFormatter`](/documentation/UIKit/UIMarkupTextPrintFormatter) initialized with the HTML, set the inherited layout properties, and add the object to the print job in one of two ways:

- If a single print formatter is being used for the print job (with no additional drawing), assign it to the [`printFormatter`](/documentation/UIKit/UIPrintInteractionController/printFormatter) property of the [`UIPrintInteractionController`](/documentation/UIKit/UIPrintInteractionController) shared instance.  The inherited [`startPage`](/documentation/UIKit/UIPrintFormatter/startPage) property identifies the beginning page of content with which the formatter is associated.
- If you are using multiple formatters along with a page renderer, associate each print formatter with a starting page of the printed content. You often take this approach when you want to add content such as headers and footers to what the formatters provide. You have two ways of associating a print formatter with a  [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) object:
- You can add print formatters to the [`printFormatters`](/documentation/UIKit/UIPrintPageRenderer/printFormatters) property of the [`UIPrintPageRenderer`](/documentation/UIKit/UIPrintPageRenderer) object; the [`startPage`](/documentation/UIKit/UIPrintFormatter/startPage) property of the print formatter specifies the starting page.
- You can add print formatters by calling [`addPrintFormatter(_:startingAtPageAt:)`](/documentation/UIKit/UIPrintPageRenderer/addPrintFormatter(_:startingAtPageAt:)) for each print formatter; the second parameter of this method specifies the starting page (and overrides any [`startPage`](/documentation/UIKit/UIPrintFormatter/startPage) value).

You can change the markup text at any time before the drawing of the printable content begins.

## Topics

### Creating a markup-text print formatter

[`init(markupText:)`](/documentation/UIKit/UIMarkupTextPrintFormatter/init(markupText:))

Returns a markup-text print formatter initialized with an HTML string.

### Getting and setting the markup text

[`markupText`](/documentation/UIKit/UIMarkupTextPrintFormatter/markupText)

The HTML markup text for the print formatter.



---

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)