ChoiceField

Overview

ChoiceField is a class in Aspose.PDF FOSS for .NET. Inherits from: Field.

This class provides 25 methods for working with ChoiceField objects in .NET programs. Available methods include: Accept, AddOption, ChangeAfterResize, ChoiceField, Clone, CopyTo, DeleteOption, ExecuteFieldJavaScript, ExportToJson, ExportValueToJson, Field, Flatten, and 10 additional methods. All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: Action, Actions, ActiveState, Alignment, AlternateName, AnnotationFlags, and 82 more.

Properties

NameTypeAccessDescription
IsComboboolReadGets the is combo.
IsEditableboolReadGets the is editable.
IsMultiSelectboolReadGets the is multi select.
IsSortedboolReadGets the is sorted.
MultiSelectboolRead/WriteGet/set MultiSelect (/Ff bit 22 — 0-based 21).
CommitImmediatelyboolRead/WriteGet/set CommitOnSelChange (/Ff bit 27 — 0-based 26).
SelectedItemsint[]Read/Write0-based selected-option indices (int[] sibling of SelectedIndices; setter rewrites /V from the matching options).
SelectedValuesIReadOnlyList<string>Read/WriteThe currently selected values.
SelectedIndicesIReadOnlyList<int>ReadThe 0-based indices of selected values within the Options list.
OptionsOptionCollectionReadThe collection of choice options.
SelectedintRead/Write1-based index of the currently selected option, or -1 when no option is selected or the selection cannot be matched against the option list.
Valuestring?Read/WriteThe field value (/V).
TypeFieldTypeReadThe field type.
FullNamestring?ReadThe fully qualified field name.
Namestring?Read/WriteThe fully qualified field name (alias for FullName).
TextHorizontalAlignmentAspose.Pdf.HorizontalAlignmentRead/WriteText-specific horizontal alignment override applied to the field’s widget appearance.
PageIndexintRead1-based index of the page that owns this field’s widget.
PartialNamestring?Read/WriteThe partial field name (/T).
NormalAppearanceXForm?ReadThe field’s “Normal” appearance (the /AP /N entry).
AppearanceAspose.Pdf.Annotations.AppearanceDictionaryReadThe field widget’s appearance streams (the /AP entry), keyed by appearance name.
OnActivatedAnnotations.PdfAction?Read/WriteThe action triggered when this field is activated (/A entry).
CountintReadNumber of kids in this field’s /Kids array — either child fields (hierarchy nodes) or widget annotations (a terminal field with multiple visual widgets, such as a grouped checkbox/radio).
FieldsField[]ReadField-typed child kids of this field as a snapshot array — convenience accessor mirroring Fields on the form.
DefaultValuestring?ReadThe default value (/DV).
AlternateNamestring?Read/WriteThe alternate field name / tooltip (/TU entry).
FlagsAspose.Pdf.Annotations.AnnotationFlagsRead/WriteThe widget annotation flags (/F entry), e.g.
TabOrderintRead/WriteTab order index for this field.
IsReadOnlyboolReadWhether the field is read-only.
ReadOnlyboolRead/WriteWhether the field is read-only (settable alias for API parity).
IsRequiredboolReadWhether the field is required.
CharacteristicsAspose.Pdf.Annotations.CharacteristicsReadAppearance characteristics (border / background colors, widget rotation).
DefaultAppearanceAspose.Pdf.Annotations.DefaultAppearanceRead/WriteDefault appearance (font, size, colour) of the field — per published reference on WidgetAnnotation.
RectRectangle?Read/WriteThe field rectangle.
BorderBorder?Read/WriteThe field border.
ColorColorRead/WriteThe field color (stored in /DA default appearance string as RGB).
AnnotationIndexintRead/Write1-based index of the widget annotation used by AcroForm rendering when the field has multiple widgets.
FitIntoRectangleboolRead/WriteGlobal flag: when true, a field’s value is auto-resized to fit its widget rectangle.
IsGroupboolReadWhether this field is a container/group of child fields.
IsSharedFieldboolRead/WriteWhether this field belongs to a shared-fields group.
IsSynchronizedboolReadWhether the collection is thread-safe.
SyncRootobjectReadSynchronization root; returns this instance.
MaxFontSizedoubleRead/WriteMaximum font size used by the field’s appearance auto-fit.
MinFontSizedoubleRead/WriteMinimum font size used by the field’s appearance auto-fit.
MappingNamestring?Read/WriteMapping name used by external scripts to identify the field.
AnnotationTypeAnnotationTypeReadAlways Widget.
ActionsAnnotationActionCollectionReadAction slots for the widget’s /AA tree.
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).
ParentForms.Field?ReadParent Field when this widget is the visual child of an AcroForm field.
RequiredboolRead/WriteWhether the widget must be filled before submit (/Ff bit 2).
HighlightModestringReadThe highlight mode (/H entry).
DefaultAppearanceStringstring?ReadThe default appearance string (/DA entry).
FieldValuestring?ReadThe field value (/V entry).
DefaultFieldValuestring?ReadThe default field value (/DV entry).
FieldTypestring?ReadThe field type (/FT entry).
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.
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).
InteriorColorColor?Read/WriteThe annotation interior color (/IC entry, for circle/square/line annotations).
Titlestring?Read/WriteThe annotation title (author for markup annotations).
Subjectstring?Read/WriteThe annotation subject (/Subj entry).
ModifiedDatestring?ReadThe modification date.
ModifiedDateTimeRead/WriteThe /M (modified) date as a typed DateTime.
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.
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
ChoiceField(doc: Document)Calls ChoiceField on this ChoiceField instance.
ChoiceField(doc: Document, rect: Rectangle)
ChoiceField(page: Page, rect: Rectangle)
AddOption(optionName: string)Add an option to the choice field.
AddOption(export: string, name: string)Add an option with separate export and display values.
DeleteOption(optionName: string)Remove the first option matching optionName (either as a bare PdfString or as the display half of an [export, name] pair).
Field(doc: Document)Create a field bound to a document.
GetEnumerator()Iterates widget annotations for this field’s kids in the /Kids array.
CopyTo(array: Aspose.Pdf.Annotations.WidgetAnnotation[], index: int)Copy widget annotations into an array starting at index.
ExecuteFieldJavaScript(javaScriptAction: Aspose.Pdf.Annotations.JavascriptAction)Execute the supplied JavaScript action against this field.
ExportToJson(stream: Stream)Serialise this field to JSON (a single FieldExportingData object) via the supplied stream.
ExportValueToJson(outputJsonStream: Stream, indented: bool)Write the field’s name, flags and value to a JSON stream.
Flatten()Flatten this field — turn its value into static page content.
GetWidgetEnumerator()Enumerator typed to WidgetAnnotation.
ImportValueFromJson(inputJsonStream: Stream)Read this field’s value from a JSON stream.
Recalculate()Recalculate the field’s value from its calculation script.
SetPosition(point: Aspose.Pdf.Point)Move the field’s first widget rectangle to the supplied point (top-left corner).
WidgetAnnotation(doc: Document)Programmatic ctor — creates a bare widget annotation associated with doc’s reader.
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 ChoiceField 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).
Clone()Shallow clone — copies scalar/ref-shared state.

See Also