Table of Contents

Class BaseField

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll
public abstract class BaseField
Inheritance
BaseField
Derived
Inherited Members

Constructors

BaseField(PdfWriter, Rectangle, string)

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

protected BaseField(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

Fields

BORDER_WIDTH_MEDIUM

A medium border with 2 point width.

public const float BORDER_WIDTH_MEDIUM = 2

Field Value

float

BORDER_WIDTH_THICK

A thick border with 3 point width.

public const float BORDER_WIDTH_THICK = 3

Field Value

float

BORDER_WIDTH_THIN

A thin border with 1 point width.

public const float BORDER_WIDTH_THIN = 1

Field Value

float

COMB

combo box flag.

public const int COMB = 16777216

Field Value

int

DO_NOT_SCROLL

The field will not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than will fit within its annotation rectangle. Once the field is full, no further text will be accepted.

public const int DO_NOT_SCROLL = 8388608

Field Value

int

DO_NOT_SPELL_CHECK

The text entered in the field will not be spell-checked. This flag is meaningful only in text fields and in combo fields with the EDIT flag set.

public const int DO_NOT_SPELL_CHECK = 4194304

Field Value

int

EDIT

If set the combo box includes an editable text box as well as a drop list; if clear, it includes only a drop list. This flag is only meaningful with combo fields.

public const int EDIT = 262144

Field Value

int

FILE_SELECTION

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 const int FILE_SELECTION = 1048576

Field Value

int

HIDDEN

The field is hidden.

public const int HIDDEN = 1

Field Value

int

HIDDEN_BUT_PRINTABLE

The field is hidden but is printable.

public const int HIDDEN_BUT_PRINTABLE = 3

Field Value

int

MULTILINE

The field may contain multiple lines of text. This flag is only meaningful with text fields.

public const int MULTILINE = 4096

Field Value

int

PASSWORD

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

public const int PASSWORD = 8192

Field Value

int

READ_ONLY

The user may not change the value of the field.

public const int READ_ONLY = 1

Field Value

int

REQUIRED

The field must have a value at the time it is exported by a submit-form action.

public const int REQUIRED = 2

Field Value

int

VISIBLE

The field is visible.

public const int VISIBLE = 0

Field Value

int

VISIBLE_BUT_DOES_NOT_PRINT

The field is visible but does not print.

public const int VISIBLE_BUT_DOES_NOT_PRINT = 2

Field Value

int

alignment

protected int alignment

Field Value

int

backgroundColor

protected BaseColor backgroundColor

Field Value

BaseColor

borderColor

protected BaseColor borderColor

Field Value

BaseColor

borderStyle

protected int borderStyle

Field Value

int

borderWidth

protected float borderWidth

Field Value

float

box

protected Rectangle box

Field Value

Rectangle

fieldName

Holds value of property fieldName.

protected string fieldName

Field Value

string

font

protected BaseFont font

Field Value

BaseFont

fontSize

protected float fontSize

Field Value

float

maxCharacterLength

Holds value of property maxCharacterLength.

protected int maxCharacterLength

Field Value

int

options

Holds value of property options.

protected int options

Field Value

int

rotation

Holds value of property rotation.

protected int rotation

Field Value

int

text

protected string text

Field Value

string

textColor

protected BaseColor textColor

Field Value

BaseColor

visibility

Holds value of property visibility.

protected int visibility

Field Value

int

writer

protected PdfWriter writer

Field Value

PdfWriter

Properties

Alignment

Sets the text horizontal alignment. It can be Element.ALIGN_LEFT , Element.ALIGN_CENTER and Element.ALIGN_RIGHT .

public int Alignment { get; set; }

Property Value

int

BackgroundColor

Sets the background color. Set to null for transparent background.

public BaseColor BackgroundColor { get; set; }

Property Value

BaseColor

BorderColor

Sets the border color. Set to null to remove the border.

public BaseColor BorderColor { get; set; }

Property Value

BaseColor

BorderStyle

Sets the border style. The styles are found in PdfBorderDictionary and can be STYLE_SOLID , STYLE_DASHED , STYLE_BEVELED , STYLE_INSET and STYLE_UNDERLINE .

public int BorderStyle { get; set; }

Property Value

int

BorderWidth

Sets the border width in points. To eliminate the border set the border color to null .

public float BorderWidth { get; set; }

Property Value

float

Box

Sets the field dimension and position.

public Rectangle Box { get; set; }

Property Value

Rectangle

FieldName

Sets the field name. will be included in the field allowing it to be used as a kid field.

public string FieldName { get; set; }

Property Value

string

Font

Sets the text font. If null then Helvetica will be used.

public BaseFont Font { get; set; }

Property Value

BaseFont

FontSize

Sets the font size. If 0 then auto-sizing will be used but only for text fields.

public float FontSize { get; set; }

Property Value

float

MaxCharacterLength

Sets the maximum length of the field�s text, in characters. It is only meaningful for text fields.

public int MaxCharacterLength { get; set; }

Property Value

int

Options

Sets the option flags. The option flags can be a combination by oring of READ_ONLY , REQUIRED , MULTILINE , DO_NOT_SCROLL , PASSWORD , FILE_SELECTION , DO_NOT_SPELL_CHECK and EDIT .

public int Options { get; set; }

Property Value

int

RealFont

protected BaseFont RealFont { get; }

Property Value

BaseFont

Rotation

Sets the field rotation. This value should be the same as the page rotation where the field will be shown.

public int Rotation { get; set; }

Property Value

int

Text

Sets the text for text fields.

public string Text { get; set; }

Property Value

string

TextColor

Sets the text color. If null the color used will be black.

public BaseColor TextColor { get; set; }

Property Value

BaseColor

Visibility

Sets the field visibility flag. This flags can be one of VISIBLE , HIDDEN , VISIBLE_BUT_DOES_NOT_PRINT and HIDDEN_BUT_PRINTABLE .

public int Visibility { get; set; }

Property Value

int

Writer

public PdfWriter Writer { get; set; }

Property Value

PdfWriter

Methods

BreakLines(List<string>, BaseFont, float, float)

protected static IList<string> BreakLines(List<string> breaks, BaseFont font, float fontSize, float width)

Parameters

breaks List<string>
font BaseFont
fontSize float
width float

Returns

IList<string>

GetBorderAppearance()

protected PdfAppearance GetBorderAppearance()

Returns

PdfAppearance

GetHardBreaks(string)

protected static IList<string> GetHardBreaks(string text)

Parameters

text string

Returns

IList<string>

MoveFields(PdfDictionary, PdfDictionary)

Moves the field keys from from to to . The moved keys are removed from from .

public static void MoveFields(PdfDictionary from, PdfDictionary to)

Parameters

from PdfDictionary

the source

to PdfDictionary

the destination. It may be null

SetRotationFromPage(Rectangle)

Convenience method to set the field rotation the same as the page rotation.

public void SetRotationFromPage(Rectangle page)

Parameters

page Rectangle

the page

TrimRight(StringBuilder)

protected static void TrimRight(StringBuilder buf)

Parameters

buf StringBuilder