---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/WidgetAnnotation
---

# WidgetAnnotation

## Overview

`WidgetAnnotation` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `Annotation`.

This class provides 13 methods for working with WidgetAnnotation objects in .NET programs.
Available methods include: `Accept`, `ChangeAfterResize`, `Clone`, `ExportToJson`, `Flatten`, `GetCheckedStateName`, `GetRectangle`, `UpdateAppearances`, `WidgetAnnotation`, `WriteXfdf`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Action`, `Actions`, `ActiveState`, `Alignment`, `AnnotationFlags`, `AnnotationState`, and 52 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `AnnotationType` | `AnnotationType` | Read | Always Widget. |
| `Border` | `Border?` | Read/Write | Border width, style and dash pattern resolved from the widget's BS dictionary (form fields carry their border there, not in /Border). |
| `Actions` | `AnnotationActionCollection` | Read | Action slots for the widget's /AA tree. |
| `DefaultAppearance` | `DefaultAppearance` | Read/Write | Default-appearance string parsed into the typed DefaultAppearance wrapper. |
| `Exportable` | `bool` | Read/Write | Whether the widget's value should be exported on form submit. |
| `Highlighting` | `HighlightingMode` | Read/Write | Visual highlighting mode used when the user clicks the widget (/H entry). |
| `OnActivated` | `PdfAction?` | Read/Write | Action invoked when the widget is activated (/A entry). |
| `Parent` | `Forms.Field?` | Read | Parent Field when this widget is the visual child of an AcroForm field. |
| `ReadOnly` | `bool` | Read/Write | Whether the widget rejects input (/Ff bit 1). |
| `Required` | `bool` | Read/Write | Whether the widget must be filled before submit (/Ff bit 2). |
| `HighlightMode` | `string` | Read | The highlight mode (/H entry). |
| `DefaultAppearanceString` | `string?` | Read | The default appearance string (/DA entry). |
| `NormalAppearance` | `XForm?` | Read | The widget's "Normal" appearance (the /AP /N stream). |
| `FieldValue` | `string?` | Read | The field value (/V entry). |
| `DefaultFieldValue` | `string?` | Read | The default field value (/DV entry). |
| `FieldType` | `string?` | Read | The field type (/FT entry). |
| `Rect` | `Rectangle?` | Read/Write | The annotation rectangle (position on page). |
| `Width` | `double` | Read/Write | The width of the annotation rectangle. |
| `Height` | `double` | Read/Write | The height of the annotation rectangle. |
| `ActiveState` | `string?` | Read/Write | Currently-active appearance state (/AS entry). |
| `Alignment` | `TextAlignment` | Read/Write | Text alignment (for free-text / widget annotations carrying rich text). |
| `HorizontalAlignment` | `Aspose.Pdf.HorizontalAlignment` | Read/Write | Horizontal alignment, exposed in addition to Alignment; the two are independently settable. |
| `TextHorizontalAlignment` | `Aspose.Pdf.HorizontalAlignment` | Read/Write | Text-specific horizontal alignment override. |
| `Appearance` | `AppearanceDictionary` | Read | Appearance dictionary (/AP entry) — keyed by appearance stream name (N, D, R). |
| `States` | `AppearanceDictionary` | Read | Appearance-state dictionary (the per-state sub-dict of AP/N, e.g. |
| `UpdateAppearanceOnConvert` | `bool` | Read/Write | Whether to regenerate the appearance stream when the annotation is saved into a converted document. |
| `UseFontSubset` | `bool` | Read/Write | Whether the embedded font (if any) should be subsetted. |
| `Contents` | `string?` | Read/Write | The annotation contents (text). |
| `Opacity` | `double` | Read/Write | Annotation opacity (0.0 = transparent, 1.0 = opaque). |
| `Color` | `Color` | Read/Write | The annotation border color (/C entry). |
| `InteriorColor` | `Color?` | Read/Write | The annotation interior color (/IC entry, for circle/square/line annotations). |
| `Title` | `string?` | Read/Write | The annotation title (author for markup annotations). |
| `Name` | `string?` | Read/Write | The annotation name (unique identifier — the /NM entry). |
| `FullName` | `string?` | Read | Fully-qualified annotation name. |
| `Subject` | `string?` | Read/Write | The annotation subject (/Subj entry). |
| `ModifiedDate` | `string?` | Read | The modification date. |
| `Modified` | `DateTime` | Read/Write | The /M (modified) date as a typed DateTime. |
| `Flags` | `AnnotationFlags` | Read/Write | Annotation flags (/F entry) — used as the storage backing for both the int and typed forms. |
| `AnnotationFlags` | `AnnotationFlags` | Read/Write | Typed alias of Flags exposing AnnotationFlags as a property. |
| `Action` | `PdfAction?` | Read/Write | The action associated with this annotation (/A entry). |
| `Author` | `string?` | Read | The annotation author (/T entry). |
| `AnnotationState` | `string?` | Read | The annotation state (/State entry), e.g. |
| `AnnotationStateModel` | `string?` | Read | The annotation state model (/StateModel entry), e.g. |
| `ReplyType` | `string?` | Read | The reply type (/RT entry), e.g. |
| `InReplyTo` | `Annotation?` | Read/Write | The annotation this one is replying to (/IRT entry). |
| `QuadPoints` | `Point[]` | Read/Write | QuadPoints as an array of Point values. |
| `Characteristics` | `Characteristics` | Read | Appearance characteristics (border color, background color, rotation). |
| `PageIndex` | `int` | Read | 1-based index of the page that owns this annotation. |
| `Page` | `Page?` | Read | The page that owns this annotation, or null when it can't be resolved (e.g. |
| `VerticalAlignment` | `VerticalAlignment` | Read/Write | Vertical alignment applied to this paragraph. |
| `Margin` | `MarginInfo?` | Read/Write | Outer-margin info applied to this paragraph. |
| `IsFirstParagraphInColumn` | `bool` | Read/Write | Force the paragraph to start a new column. |
| `IsKeptWithNext` | `bool` | Read/Write | Keep this paragraph on the same page as the next one. |
| `IsInNewPage` | `bool` | Read/Write | Force the paragraph to start on a new page. |
| `IsInLineParagraph` | `bool` | Read/Write | Inline paragraph flag (does not start a new line). |
| `HyperlinkText` | `string?` | Read/Write | Legacy string-typed hyperlink target. |
| `Hyperlink` | `Hyperlink?` | Read/Write | Typed hyperlink decoration applied to the paragraph. |
| `ZIndex` | `int` | Read/Write | Z-order index used by the DOM renderer. |

## Methods

| Signature | Description |
|-----------|-------------|
| `WidgetAnnotation(doc: Document)` | Programmatic ctor — creates a bare widget annotation associated with doc's reader. |
| `ExportToJson(stream: System.IO.Stream)` | Serialise this widget's field as JSON to a stream. |
| `ExportToJson(fileName: string)` | Serialise this widget's field as JSON to a file. |
| `ExportToJson(stream: System.IO.Stream, options: ExportFieldsToJsonOptions?)` | Serialise this widget's field as a single FieldExportingData JSON object to a stream. |
| `ExportToJson(fileName: string, options: ExportFieldsToJsonOptions?)` | Serialise this widget's field as JSON to a file. |
| `GetCheckedStateName()` | Returns the appearance state name that represents the "on" / "checked" state of this widget (typically "Yes"), looked up from the /AP/N dict's keys (anything that isn't "Off"). |
| `Accept(visitor: AnnotationSelector)` | Calls Accept on this WidgetAnnotation instance. |
| `GetRectangle(considerRotation: bool)` | Bounding rectangle adjusted by considerRotation. |
| `ChangeAfterResize(transform: Matrix)` | Adjust the annotation's geometry after the user resized the page or the host rectangle. |
| `UpdateAppearances()` | Regenerate the normal appearance stream (/AP /N) from the annotation's current geometry and colours. |
| `WriteXfdf(writer: System.Xml.XmlWriter)` | Serialize this annotation as an XFDF element to writer (PDF 32000 §12.7.8 / XFDF 3.0). |
| `Flatten()` | Flatten this annotation — render its visual appearance into the page content and remove it from the page's annotations array. |
| `Clone()` | Shallow clone — copies scalar/ref-shared state. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)