---
title: "setAlignment(_:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfannotationfreetext/setalignment(_:)"
---

# setAlignment(_:)

Sets the horizontal alignment of text within the bounds of the annotation.

## Declaration

```swift
func setAlignment(_ alignment: NSTextAlignment)
```

## Parameters

- `alignment`: Send NSLeftTextAlignment, NSRightTextAlignment, or NSCenterTextAlignment to set the horizontal alignment of text within the bounds of the annotation.

## See Also

### Managing Text Alignment

- [alignment()](pdfkit/pdfannotationfreetext/alignment().md)
