Table of Contents

Class TextField

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

Supports text, combo and list fields generating the correct appearances. All the option in the Acrobat GUI are supported in an easy to use API. @author Paulo Soares (psoares@consiste.pt)

public class TextField : BaseField
Inheritance
TextField
Inherited Members

Constructors

TextField(PdfWriter, Rectangle, string)

Creates a new TextField . will be included in the field allowing it to be used as a kid field.

public TextField(PdfWriter writer, Rectangle box, string fieldName)

Parameters

writer PdfWriter

the document PdfWriter

box Rectangle

the field location and dimensions

fieldName string

the field name. If null only the widget keys

Properties

ChoiceExports

Sets the export values in list/combo fields. If this array is null then the choice values will also be used as the export values.

public string[] ChoiceExports { get; set; }

Property Value

string[]

ChoiceSelection

Sets the zero based index of the selected item.

public int ChoiceSelection { get; set; }

Property Value

int

Choices

Sets the choices to be presented to the user in list/combo fields.

public string[] Choices { get; set; }

Property Value

string[]

DefaultText

Sets the default text. It is only meaningful for text fields.

public string DefaultText { get; set; }

Property Value

string

ExtensionFont

Sets the extensionFont. This font will be searched before the substitution fonts. It may be null .

public BaseFont ExtensionFont { get; set; }

Property Value

BaseFont

SubstitutionFonts

Sets a list of substitution fonts. The list is composed of BaseFont and can also be null . The fonts in this list will be used if the original font doesn't contain the needed glyphs.

public IList<BaseFont> SubstitutionFonts { get; set; }

Property Value

IList<BaseFont>

Methods

GetAppearance()

Get the PdfAppearance of a text or combo field @throws IOException on error @throws DocumentException on error

public PdfAppearance GetAppearance()

Returns

PdfAppearance

A PdfAppearance

GetChoiceField(bool)

protected PdfFormField GetChoiceField(bool isList)

Parameters

isList bool

Returns

PdfFormField

GetComboField()

Gets a new combo field. @throws IOException on error @throws DocumentException on error

public PdfFormField GetComboField()

Returns

PdfFormField

a new combo field

GetListField()

Gets a new list field. @throws IOException on error @throws DocumentException on error

public PdfFormField GetListField()

Returns

PdfFormField

a new list field

GetTextField()

Gets a new text field. @throws IOException on error @throws DocumentException on error

public PdfFormField GetTextField()

Returns

PdfFormField

a new text field

ObfuscatePassword(string)

Obfuscates a password String . Every character is replaced by an asterisk (*). @since 2.1.5

public static string ObfuscatePassword(string text)

Parameters

text string

Returns

string

String

RemoveCrlf(string)

public static string RemoveCrlf(string text)

Parameters

text string

Returns

string

SetExtraMargin(float, float)

Sets extra margins in text fields to better mimic the Acrobat layout.

public void SetExtraMargin(float extraMarginLeft, float extraMarginTop)

Parameters

extraMarginLeft float

the extra marging left

extraMarginTop float

the extra margin top