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

NameTypeAccessDescription
AnnotationTypeAnnotationTypeReadAlways Widget.
BorderBorder?Read/WriteBorder width, style and dash pattern resolved from the widget’s BS dictionary (form fields carry their border there, not in /Border).
ActionsAnnotationActionCollectionReadAction slots for the widget’s /AA tree.
DefaultAppearanceDefaultAppearanceRead/WriteDefault-appearance string parsed into the typed DefaultAppearance wrapper.
ExportableboolRead/WriteWhether the widget’s value should be exported on form submit.
HighlightingHighlightingModeRead/WriteVisual highlighting mode used when the user clicks the widget (/H entry).
OnActivatedPdfAction?Read/WriteAction invoked when the widget is activated (/A entry).
ParentForms.Field?ReadParent Field when this widget is the visual child of an AcroForm field.
ReadOnlyboolRead/WriteWhether the widget rejects input (/Ff bit 1).
RequiredboolRead/WriteWhether the widget must be filled before submit (/Ff bit 2).
HighlightModestringReadThe highlight mode (/H entry).
DefaultAppearanceStringstring?ReadThe default appearance string (/DA entry).
NormalAppearanceXForm?ReadThe widget’s “Normal” appearance (the /AP /N stream).
FieldValuestring?ReadThe field value (/V entry).
DefaultFieldValuestring?ReadThe default field value (/DV entry).
FieldTypestring?ReadThe field type (/FT entry).
RectRectangle?Read/WriteThe annotation rectangle (position on page).
WidthdoubleRead/WriteThe width of the annotation rectangle.
HeightdoubleRead/WriteThe height of the annotation rectangle.
ActiveStatestring?Read/WriteCurrently-active appearance state (/AS entry).
AlignmentTextAlignmentRead/WriteText alignment (for free-text / widget annotations carrying rich text).
HorizontalAlignmentAspose.Pdf.HorizontalAlignmentRead/WriteHorizontal alignment, exposed in addition to Alignment; the two are independently settable.
TextHorizontalAlignmentAspose.Pdf.HorizontalAlignmentRead/WriteText-specific horizontal alignment override.
AppearanceAppearanceDictionaryReadAppearance dictionary (/AP entry) — keyed by appearance stream name (N, D, R).
StatesAppearanceDictionaryReadAppearance-state dictionary (the per-state sub-dict of AP/N, e.g.
UpdateAppearanceOnConvertboolRead/WriteWhether to regenerate the appearance stream when the annotation is saved into a converted document.
UseFontSubsetboolRead/WriteWhether the embedded font (if any) should be subsetted.
Contentsstring?Read/WriteThe annotation contents (text).
OpacitydoubleRead/WriteAnnotation opacity (0.0 = transparent, 1.0 = opaque).
ColorColorRead/WriteThe annotation border color (/C entry).
InteriorColorColor?Read/WriteThe annotation interior color (/IC entry, for circle/square/line annotations).
Titlestring?Read/WriteThe annotation title (author for markup annotations).
Namestring?Read/WriteThe annotation name (unique identifier — the /NM entry).
FullNamestring?ReadFully-qualified annotation name.
Subjectstring?Read/WriteThe annotation subject (/Subj entry).
ModifiedDatestring?ReadThe modification date.
ModifiedDateTimeRead/WriteThe /M (modified) date as a typed DateTime.
FlagsAnnotationFlagsRead/WriteAnnotation flags (/F entry) — used as the storage backing for both the int and typed forms.
AnnotationFlagsAnnotationFlagsRead/WriteTyped alias of Flags exposing AnnotationFlags as a property.
ActionPdfAction?Read/WriteThe action associated with this annotation (/A entry).
Authorstring?ReadThe annotation author (/T entry).
AnnotationStatestring?ReadThe annotation state (/State entry), e.g.
AnnotationStateModelstring?ReadThe annotation state model (/StateModel entry), e.g.
ReplyTypestring?ReadThe reply type (/RT entry), e.g.
InReplyToAnnotation?Read/WriteThe annotation this one is replying to (/IRT entry).
QuadPointsPoint[]Read/WriteQuadPoints as an array of Point values.
CharacteristicsCharacteristicsReadAppearance characteristics (border color, background color, rotation).
PageIndexintRead1-based index of the page that owns this annotation.
PagePage?ReadThe page that owns this annotation, or null when it can’t be resolved (e.g.
VerticalAlignmentVerticalAlignmentRead/WriteVertical alignment applied to this paragraph.
MarginMarginInfo?Read/WriteOuter-margin info applied to this paragraph.
IsFirstParagraphInColumnboolRead/WriteForce the paragraph to start a new column.
IsKeptWithNextboolRead/WriteKeep this paragraph on the same page as the next one.
IsInNewPageboolRead/WriteForce the paragraph to start on a new page.
IsInLineParagraphboolRead/WriteInline paragraph flag (does not start a new line).
HyperlinkTextstring?Read/WriteLegacy string-typed hyperlink target.
HyperlinkHyperlink?Read/WriteTyped hyperlink decoration applied to the paragraph.
ZIndexintRead/WriteZ-order index used by the DOM renderer.

Methods

SignatureDescription
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