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

# setMaximumLength(_:)

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

```
func setMaximumLength(_ maxLen: Int)
```

## Parameters

`maxLen`

The maximum number of characters allowed in the annotation string. Pass `0` to indicate that there is no specified maximum.

## See Also

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

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



---

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)