---
title: "bounds(for:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfpage/bounds(for:)"
---

# bounds(for:)

Returns the bounds for the specified PDF display box.

## Declaration

```swift
func bounds(for box: PDFDisplayBox) -> CGRect
```

```swift
func bounds(for box: PDFDisplayBox) -> NSRect
```

## Discussion

Discussion The PDFDisplayBox enumeration defines the various box types. Note that only the media box is required for a PDF. If you request the bounds for the crop box, but the PDF does not include a crop box, the bounds for the media box are returned instead. If you request the bounds for other box types, and the PDF does not includes these types, the bounds for the crop box are returned instead. The coordinates for the box are in page space, so you might need to transform the points if the page has a rotation on it. Also, note that the bounds boundsForBox returns are intersected with the page’s media box. boundsForBox throws a range exception if box is not in range.

## See Also

### Related Documentation

- [PDFPage](pdfkit/pdfpage.md)

### Getting Information About a Page

- [document](pdfkit/pdfpage/document.md)
- [label](pdfkit/pdfpage/label.md)
- [setBounds(_:for:)](pdfkit/pdfpage/setbounds(_:for:).md)
- [rotation](pdfkit/pdfpage/rotation.md)
