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

# setBounds(_:for:)

Sets the bounds for the specified box.

## Declaration

```swift
func setBounds(_ bounds: CGRect, for box: PDFDisplayBox)
```

```swift
func setBounds(_ bounds: NSRect, for box: PDFDisplayBox)
```

## Discussion

Discussion If the box does not exist, this method creates it for you. To remove a box, pass NSZeroRect for the bounds (note that you cannot remove the media box). If the box bounds are not in range, this method throws a range exception.

## See Also

### Getting Information About a Page

- [document](pdfkit/pdfpage/document.md)
- [label](pdfkit/pdfpage/label.md)
- [bounds(for:)](pdfkit/pdfpage/bounds(for:).md)
- [rotation](pdfkit/pdfpage/rotation.md)
