<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFSelection/draw(for:with:active:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFSelection(im)drawForPage:withBox:active:"
  },
  "title" : "draw(for:with:active:)"
}
-->

# draw(for:with:active:)

Draws the selection relative to the origin of the specified box in page space.

```
func draw(for page: PDFPage, with box: PDFDisplayBox, active: Bool)
```

## Discussion

The selection is drawn using the current highlight color. If active is <doc://com.apple.documentation/documentation/Swift/true>, drawing uses `selectedTextBackgroundColor`. If <doc://com.apple.documentation/documentation/Swift/false>, it uses `secondarySelectedControlColor`. Refer to the [`PDFPage`](/documentation/PDFKit/PDFPage) class for the list of available box types.

Page space is a 72 dpi coordinate system with the origin at the lower-left corner of the current page.

---

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)