<!--
{
  "availability" : [
    "macOS: 10.5.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFPage/transformContext(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFPage(im)transformContextForBox:"
  },
  "title" : "transformContext(for:)"
}
-->

# transformContext(for:)

Transforms the current context, given the specified box.

```
func transformContext(for box: PDFDisplayBox)
```

## Discussion

When transforming the current context, this method takes into account the rotation of the page, as well as the origin of the box with respect to the page’s base coordinate system. This is a convenient method to call within the `PDFView` [`draw(_:)`](/documentation/PDFKit/PDFView/draw(_:)) method or from within a draw method of a `PDFAnnotation` subclass.

## See Also

[`PDFPage`](/documentation/PDFKit/PDFPage)

`PDFPage`, a subclass of `NSObject`, defines methods used to render PDF pages and work with annotations, text, and selections.



---

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)