Table of Contents

Class PdfChoiceFormField

Namespace
iText.Forms.Fields
Assembly
itext.forms.dll

An AcroForm field type representing any type of choice field.

public class PdfChoiceFormField : PdfFormField
Inheritance
PdfChoiceFormField
Inherited Members

Remarks

An AcroForm field type representing any type of choice field. Choice fields are to be represented by a viewer as a list box or a combo box.

Constructors

PdfChoiceFormField(PdfWidgetAnnotation, PdfDocument)

Creates a choice form field as a parent of a PdfWidgetAnnotation.

protected PdfChoiceFormField(PdfWidgetAnnotation widget, PdfDocument pdfDocument)

Parameters

widget PdfWidgetAnnotation

The widget which will be a kid of the PdfChoiceFormField.

pdfDocument PdfDocument

The PdfDocument instance.

PdfChoiceFormField(PdfDictionary)

Creates a choice form field as a wrapper object around a PdfDictionary.

protected PdfChoiceFormField(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

the dictionary to be wrapped, must have an indirect reference.

Remarks

Creates a choice form field as a wrapper object around a PdfDictionary. This PdfDictionary must be an indirect object.

PdfChoiceFormField(PdfDocument)

Creates a minimal PdfChoiceFormField.

protected PdfChoiceFormField(PdfDocument pdfDocument)

Parameters

pdfDocument PdfDocument

The PdfDocument instance.

Fields

FF_COMBO

If true, the field is a combo box.

public static readonly int FF_COMBO

Field Value

int

Remarks

If true, the field is a combo box. If false, the field is a list box.

FF_COMMIT_ON_SEL_CHANGE

If true, the new value shall be committed as soon as a selection is made (commonly with the pointing device).

public static readonly int FF_COMMIT_ON_SEL_CHANGE

Field Value

int

FF_DO_NOT_SPELL_CHECK

If true, text entered in the field shall be spell-checked.

public static readonly int FF_DO_NOT_SPELL_CHECK

Field Value

int

FF_EDIT

If true, the combo box shall include an editable text box as well as a drop-down list.

public static readonly int FF_EDIT

Field Value

int

Remarks

If true, the combo box shall include an editable text box as well as a drop-down list. If false, it shall include only a drop-down list. This flag shall be used only if the Combo flag is true.

FF_MULTI_SELECT

If true, more than one of the field's option items may be selected simultaneously.

public static readonly int FF_MULTI_SELECT

Field Value

int

Remarks

If true, more than one of the field's option items may be selected simultaneously. If false, at most one item shall be selected.

FF_SORT

If true, the field's option items shall be sorted alphabetically.

public static readonly int FF_SORT

Field Value

int

Remarks

If true, the field's option items shall be sorted alphabetically. This flag is intended for use by writers, not by readers.

Methods

GetFormType()

Returns Ch, the form type for choice form fields.

public override PdfName GetFormType()

Returns

PdfName

the form type, as a PdfName

GetIndices()

Gets the currently selected items in the field

public virtual PdfArray GetIndices()

Returns

PdfArray

a sorted array of indices representing the currently selected items in the field

GetTopIndex()

Gets the current index of the first option in a scrollable list.

public virtual PdfNumber GetTopIndex()

Returns

PdfNumber

the index of the first option, as a PdfNumber

IsCombo()

If true, the field is a combo box; if false, the field is a list box.

public virtual bool IsCombo()

Returns

bool

whether or not the field is now a combo box.

IsCommitOnSelChange()

If true, the new value shall be committed as soon as a selection is made (commonly with the pointing device).

public virtual bool IsCommitOnSelChange()

Returns

bool

whether or not to save changes immediately

IsEdit()

If true, the combo box shall include an editable text box as well as a drop-down list; if false, it shall include only a drop-down list.

public virtual bool IsEdit()

Returns

bool

whether or not there is currently an editable text box

Remarks

If true, the combo box shall include an editable text box as well as a drop-down list; if false, it shall include only a drop-down list. This flag shall be used only if the Combo flag is true.

IsMultiSelect()

If true, more than one of the field's option items may be selected simultaneously; if false, at most one item shall be selected.

public virtual bool IsMultiSelect()

Returns

bool

whether or not multiple selection is currently allowed

IsSort()

If true, the field's option items shall be sorted alphabetically.

public virtual bool IsSort()

Returns

bool

whether or not the items are currently sorted

Remarks

If true, the field's option items shall be sorted alphabetically. This flag is intended for use by writers, not by readers.

IsSpellCheck()

If true, text entered in the field shall be spell-checked..

public virtual bool IsSpellCheck()

Returns

bool

whether or not PDF viewer must perform a spell check

SetCombo(bool)

If true, the field is a combo box; if false, the field is a list box.

public virtual PdfChoiceFormField SetCombo(bool combo)

Parameters

combo bool

whether or not the field should be a combo box

Returns

PdfChoiceFormField

current PdfChoiceFormField

SetCommitOnSelChange(bool)

If true, the new value shall be committed as soon as a selection is made (commonly with the pointing device).

public virtual PdfChoiceFormField SetCommitOnSelChange(bool commitOnSelChange)

Parameters

commitOnSelChange bool

whether or not to save changes immediately

Returns

PdfChoiceFormField

current PdfChoiceFormField

SetEdit(bool)

If true, the combo box shall include an editable text box as well as a drop-down list; if false, it shall include only a drop-down list.

public virtual PdfChoiceFormField SetEdit(bool edit)

Parameters

edit bool

whether or not to add an editable text box

Returns

PdfChoiceFormField

current PdfChoiceFormField

Remarks

If true, the combo box shall include an editable text box as well as a drop-down list; if false, it shall include only a drop-down list. This flag shall be used only if the Combo flag is true.

SetIndices(PdfArray)

Sets the selected items in the field.

public virtual PdfChoiceFormField SetIndices(PdfArray indices)

Parameters

indices PdfArray

a sorted array of indices representing selected items in the field

Returns

PdfChoiceFormField

current PdfChoiceFormField

SetListSelected(int[])

Highlights the options.

public virtual PdfChoiceFormField SetListSelected(int[] optionNumbers)

Parameters

optionNumbers int[]

The option numbers

Returns

PdfChoiceFormField

The edited PdfChoiceFormField

Remarks

Highlights the options. If this method is used for Combo box, the first value in input array will be the field value

SetListSelected(string[])

Highlights the options.

public virtual PdfChoiceFormField SetListSelected(string[] optionValues)

Parameters

optionValues string[]

Array of display values to be highlighted.

Returns

PdfChoiceFormField

current PdfChoiceFormField.

Remarks

Highlights the options. If this method is used for Combo box, the first value in input array will be the field value.

SetListSelected(string[], bool)

Highlights the options and generates field appearance if needed.

public virtual PdfChoiceFormField SetListSelected(string[] optionValues, bool generateAppearance)

Parameters

optionValues string[]

Array of options to be highlighted

generateAppearance bool

if false, appearance won't be regenerated

Returns

PdfChoiceFormField

current PdfChoiceFormField

Remarks

Highlights the options and generates field appearance if needed. If this method is used for Combo box, the first value in input array will be the field value

SetMultiSelect(bool)

If true, more than one of the field's option items may be selected simultaneously; if false, at most one item shall be selected.

public virtual PdfChoiceFormField SetMultiSelect(bool multiSelect)

Parameters

multiSelect bool

whether or not to allow multiple selection

Returns

PdfChoiceFormField

current PdfChoiceFormField

SetSort(bool)

If true, the field's option items shall be sorted alphabetically.

public virtual PdfChoiceFormField SetSort(bool sort)

Parameters

sort bool

whether or not to sort the items

Returns

PdfChoiceFormField

current PdfChoiceFormField

Remarks

If true, the field's option items shall be sorted alphabetically. This flag is intended for use by writers, not by readers.

SetSpellCheck(bool)

If true, text entered in the field shall be spell-checked.

public virtual PdfChoiceFormField SetSpellCheck(bool spellCheck)

Parameters

spellCheck bool

whether or not to require the PDF viewer to perform a spell check

Returns

PdfChoiceFormField

current PdfChoiceFormField

SetTopIndex(int)

Sets the index of the first visible option in a scrollable list.

public virtual PdfChoiceFormField SetTopIndex(int index)

Parameters

index int

the index of the first option

Returns

PdfChoiceFormField

current PdfChoiceFormField