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

# setAlignment(_:)

Sets the text alignment for the annotation.

## Declaration

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

## Parameters

- `alignment`: The text-alignment value to be used for the annotation. Possible values are NSLeftTextAlignment, NSRightTextAlignment, and NSCenterTextAlignment.

## See Also

### Managing Background Color, Alignment, and Rotation

- [backgroundColor()](pdfkit/pdfannotationtextwidget/backgroundcolor().md)
- [setBackgroundColor(_:)](pdfkit/pdfannotationtextwidget/setbackgroundcolor(_:).md)
- [alignment()](pdfkit/pdfannotationtextwidget/alignment().md)
- [rotation()](pdfkit/pdfannotationtextwidget/rotation().md)
- [setRotation(_:)](pdfkit/pdfannotationtextwidget/setrotation(_:).md)
