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

# draw(with:)

Draws the page within the specified box.

## Declaration

```swift
func draw(with box: PDFDisplayBox)
```

## Mentioned in

Adding Custom Graphics to a PDF

## Discussion

Discussion This method takes into account the page rotation and draws clipped to the specified box. If the page is set to display annotations, this method also draws them. This method does not clear the background. To clear the background before drawing, use NSRectFill with NSColor set (typically) to white.

## See Also

### Related Documentation

- [displaysAnnotations](pdfkit/pdfpage/displaysannotations.md)

### Rendering Pages

- [transformContext(for:)](pdfkit/pdfpage/transformcontext(for:).md)
