PdfTextField Class

A text field (ISO 32000-2, 12.7.5.3): a box the user types a text in.

public sealed class PdfTextField : PdfFormField
Inheritance
PdfFormField PdfTextField

Properties

NameDescription
IsCombGets a value indicating whether the field is divided into PdfTextField.MaxLength cells of one character (bit 25 of PdfFormField.Flags).
IsMultilineGets a value indicating whether the field can have several lines (bit 13 of PdfFormField.Flags).
IsPasswordGets a value indicating whether the text is a password, shown as asterisks (bit 14 of PdfFormField.Flags).
MaxLengthGets the maximum length of the text (/MaxLen, inherited), or null when it has none.
ValueGets or sets the text of the field (/V). Setting it writes the appearances of the widgets (12.7.4.3) with the font, size and color of the default appearance (/DA), so that the text is shown and printed, and flattened, by every viewer.

Gets a value indicating whether the field is divided into PdfTextField.MaxLength cells of one character (bit 25 of PdfFormField.Flags).

public bool IsComb { get; }

Property value

bool

IsMultiline

PdfTextField.cs

Gets a value indicating whether the field can have several lines (bit 13 of PdfFormField.Flags).

public bool IsMultiline { get; }

Property value

bool

IsPassword

PdfTextField.cs

Gets a value indicating whether the text is a password, shown as asterisks (bit 14 of PdfFormField.Flags).

public bool IsPassword { get; }

Property value

bool

Gets the maximum length of the text (/MaxLen, inherited), or null when it has none.

public int? MaxLength { get; }

Property value

int?

Gets or sets the text of the field (/V). Setting it writes the appearances of the widgets (12.7.4.3) with the font, size and color of the default appearance (/DA), so that the text is shown and printed, and flattened, by every viewer.

public override string? Value { get; set; }

Property value

string?

Exceptions

InvalidOperationException
The field is read-only.

Methods

NameDescription
SetValue(string?, string?)Sets the value of the field and the text its widgets show for it, as a format script does (ISO 32000-2, 12.6.3): the value (/V) keeps value, such as 1234.5, and the appearance shows displayText, such as $1,234.50.

SetValue(string?, string?)

PdfTextField.cs

Sets the value of the field and the text its widgets show for it, as a format script does (ISO 32000-2, 12.6.3): the value (/V) keeps value, such as 1234.5, and the appearance shows displayText, such as $1,234.50.

public void SetValue(string? value, string? displayText)

Parameters

value string?
The value.
displayText string?
The text shown, or null to show the value.

Exceptions

InvalidOperationException
The field is read-only.