<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFAnnotationTextWidget",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFAnnotationTextWidget"
  },
  "title" : "PDFAnnotationTextWidget"
}
-->

# PDFAnnotationTextWidget

A `PDFAnnotationTextWidget` object allows you to manage the appearance and content of text fields.

```
class PDFAnnotationTextWidget
```

## Overview

`PDFAnnotationTextWidget` objects support interactive forms in a PDF document. This object is comparable to an editable `NSTextField` in Cocoa or an edit text view in Carbon.

## Topics

### Working with Annotation Strings

[`-  stringValue`](/documentation/PDFKit/PDFAnnotationTextWidget/stringValue())

Returns the string assigned to the annotation.

[`-  setStringValue:`](/documentation/PDFKit/PDFAnnotationTextWidget/setStringValue(_:))

Sets the string for the annotation.

[`-  maximumLength`](/documentation/PDFKit/PDFAnnotationTextWidget/maximumLength())

Returns the maximum number of characters allowed in the annotation string.

[`-  setMaximumLength:`](/documentation/PDFKit/PDFAnnotationTextWidget/setMaximumLength(_:))

Sets the maximum number of characters allowed in the annotation string.

### Managing the Font and Font Color

[`-  font`](/documentation/PDFKit/PDFAnnotationTextWidget/font())

Returns the font used for the annotation’s text field.

[`-  setFont:`](/documentation/PDFKit/PDFAnnotationTextWidget/setFont(_:))

Sets the font used in the text field of the annotation.

[`-  fontColor`](/documentation/PDFKit/PDFAnnotationTextWidget/fontColor())

Returns the font color used for the annotation’s text field.

[`-  setFontColor:`](/documentation/PDFKit/PDFAnnotationTextWidget/setFontColor(_:))

Sets the font color used for the annotation’s text field.

### Managing Background Color, Alignment, and Rotation

[`-  backgroundColor`](/documentation/PDFKit/PDFAnnotationTextWidget/backgroundColor())

Returns the background color of the annotation text field.

[`-  setBackgroundColor:`](/documentation/PDFKit/PDFAnnotationTextWidget/setBackgroundColor(_:))

Sets the background color of the annotation text field.

[`-  alignment`](/documentation/PDFKit/PDFAnnotationTextWidget/alignment())

Returns the text alignment setting for the annotation.

[`-  setAlignment:`](/documentation/PDFKit/PDFAnnotationTextWidget/setAlignment(_:))

Sets the text alignment for the annotation.

[`-  rotation`](/documentation/PDFKit/PDFAnnotationTextWidget/rotation())

Returns the rotation angle of the annotation text field in degrees.

[`-  setRotation:`](/documentation/PDFKit/PDFAnnotationTextWidget/setRotation(_:))

Sets the rotation angle of the annotation text field in degrees.

### Working with Field Names

[`-  fieldName`](/documentation/PDFKit/PDFAnnotationTextWidget/fieldName())

Returns the internal name for the annotation text field.

[`-  setFieldName:`](/documentation/PDFKit/PDFAnnotationTextWidget/setFieldName(_:))

Sets the internal field name for the annotation text field.

### Instance Methods

[`-  attributedStringValue`](/documentation/PDFKit/PDFAnnotationTextWidget/attributedStringValue())

[`-  isMultiline`](/documentation/PDFKit/PDFAnnotationTextWidget/isMultiline())

[`-  setAttributedStringValue:`](/documentation/PDFKit/PDFAnnotationTextWidget/setAttributedStringValue(_:))

[`-  setIsMultiline:`](/documentation/PDFKit/PDFAnnotationTextWidget/setIsMultiline(_:))

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`PDFAnnotation`](/documentation/PDFKit/PDFAnnotation)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)