<!--
{
  "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/drawHeaderForPage(at:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPrintPageRenderer(im)drawHeaderForPageAtIndex:inRect:"
  },
  "title" : "drawHeaderForPage(at:in:)"
}
-->

# drawHeaderForPage(at:in:)

Draws the header of a page.

```
func drawHeaderForPage(at pageIndex: Int, in headerRect: CGRect)
```

## Parameters

`pageIndex`

The index of the page on which to draw the header.

`headerRect`

The rectangle in which to draw the header content. This rectangle uses the coordinate system of the paper rectangle ([`paperRect`](/documentation/UIKit/UIPrintPageRenderer/paperRect)), with the origin of the coordinates at the top-left corner of the sheet.

## Discussion

The default implementation of this method does nothing. The system doesn’t call this method if [`headerHeight`](/documentation/UIKit/UIPrintPageRenderer/headerHeight) isn’t a positive value. Override this method to draw the header of the specified page.

The system configures this method for drawing to the current graphics context according to [`UIGraphicsGetCurrentContext()`](/documentation/UIKit/UIGraphicsGetCurrentContext()).

---

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)