Table of Contents

Class PdfTextFormField

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

An AcroForm field containing textual data.

public class PdfTextFormField : PdfFormField
Inheritance
PdfTextFormField
Inherited Members

Constructors

PdfTextFormField(PdfWidgetAnnotation, PdfDocument)

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

protected PdfTextFormField(PdfWidgetAnnotation widget, PdfDocument pdfDocument)

Parameters

widget PdfWidgetAnnotation

The widget which will be a kid of the PdfTextFormField.

pdfDocument PdfDocument

The PdfDocument instance.

PdfTextFormField(PdfDictionary)

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

protected PdfTextFormField(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

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

Remarks

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

PdfTextFormField(PdfDocument)

Creates a minimal PdfTextFormField.

protected PdfTextFormField(PdfDocument pdfDocument)

Parameters

pdfDocument PdfDocument

The PdfDocument instance.

Fields

FF_COMB

constant which determines maximum length of the field's text.

public static readonly int FF_COMB

Field Value

int

FF_DO_NOT_SCROLL

constant which determines whether longer texts are currently allowed.

public static readonly int FF_DO_NOT_SCROLL

Field Value

int

FF_DO_NOT_SPELL_CHECK

constant which determines whether spell-checking is currently enabled

public static readonly int FF_DO_NOT_SPELL_CHECK

Field Value

int

FF_FILE_SELECT

constant which determines whether field currently represents a path.

public static readonly int FF_FILE_SELECT

Field Value

int

FF_RICH_TEXT

constant which determines whether text is currently represented as rich text.

public static readonly int FF_RICH_TEXT

Field Value

int

Methods

GetFormType()

Returns Tx, the form type for textual form fields.

public override PdfName GetFormType()

Returns

PdfName

the form type, as a PdfName

GetMaxLen()

Gets the maximum length of the field's text, in characters.

public virtual int GetMaxLen()

Returns

int

the current maximum text length

Remarks

Gets the maximum length of the field's text, in characters. This is an optional parameter, so if it is not specified, 0 value will be returned.

IsComb()

Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear.

public virtual bool IsComb()

Returns

bool

whether or not combing is enabled

Remarks

Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear. If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs.

IsFileSelect()

If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.

public virtual bool IsFileSelect()

Returns

bool

whether or not this field currently represents a path

IsRichText()

If true, the value of this field should be represented as a rich text string.

public virtual bool IsRichText()

Returns

bool

whether or not text is currently represented as rich text

Remarks

If true, the value of this field should be represented as a rich text string. If the field has a value, the RV entry of the field dictionary specifies the rich text string.

IsScroll()

If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle.

public virtual bool IsScroll()

Returns

bool

whether or not longer texts are currently allowed

Remarks

If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.

IsSpellCheck()

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

public virtual bool IsSpellCheck()

Returns

bool

whether or not spell-checking is currently enabled

SetComb(bool)

Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear.

public virtual PdfTextFormField SetComb(bool comb)

Parameters

comb bool

whether or not to enable combing

Returns

PdfTextFormField

current PdfTextFormField

Remarks

Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear. If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs.

SetFileSelect(bool)

If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.

public virtual PdfTextFormField SetFileSelect(bool fileSelect)

Parameters

fileSelect bool

whether or not this field should represent a path

Returns

PdfTextFormField

current PdfTextFormField

SetMaxLen(int)

Sets the maximum length of the field's text, in characters.

public virtual PdfTextFormField SetMaxLen(int maxLen)

Parameters

maxLen int

the maximum text length

Returns

PdfTextFormField

current

SetMultiline(bool)

If true, the field can contain multiple lines of text; if false, the field?s text is restricted to a single line.

public virtual PdfTextFormField SetMultiline(bool multiline)

Parameters

multiline bool

whether or not the file can contain multiple lines of text

Returns

PdfTextFormField

current PdfTextFormField

SetPassword(bool)

If true, the field is intended for entering a secure password that should not be echoed visibly to the screen.

public virtual PdfTextFormField SetPassword(bool password)

Parameters

password bool

whether or not to obscure the typed characters

Returns

PdfTextFormField

current PdfTextFormField

Remarks

If true, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard should instead be echoed in some unreadable form, such as asterisks or bullet characters.

SetRichText(bool)

If true, the value of this field should be represented as a rich text string.

public virtual PdfTextFormField SetRichText(bool richText)

Parameters

richText bool

whether or not to represent text as rich text

Returns

PdfTextFormField

current PdfTextFormField

Remarks

If true, the value of this field should be represented as a rich text string. If the field has a value, the RV entry of the field dictionary specifies the rich text string.

SetScroll(bool)

If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle.

public virtual PdfTextFormField SetScroll(bool scroll)

Parameters

scroll bool

whether or not to allow longer texts

Returns

PdfTextFormField

current PdfTextFormField

Remarks

If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.

SetSpellCheck(bool)

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

public virtual PdfTextFormField SetSpellCheck(bool spellCheck)

Parameters

spellCheck bool

whether or not to spell-check

Returns

PdfTextFormField

current PdfTextFormField