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
PdfWriterthe document PdfWriter
box
Rectanglethe field location and dimensions
fieldName
stringthe 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
BORDER_WIDTH_THICK
A thick border with 3 point width.
public const float BORDER_WIDTH_THICK = 3
Field Value
BORDER_WIDTH_THIN
A thin border with 1 point width.
public const float BORDER_WIDTH_THIN = 1
Field Value
COMB
combo box flag.
public const int COMB = 16777216
Field Value
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
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
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
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
HIDDEN
The field is hidden.
public const int HIDDEN = 1
Field Value
HIDDEN_BUT_PRINTABLE
The field is hidden but is printable.
public const int HIDDEN_BUT_PRINTABLE = 3
Field Value
MULTILINE
The field may contain multiple lines of text. This flag is only meaningful with text fields.
public const int MULTILINE = 4096
Field Value
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
READ_ONLY
The user may not change the value of the field.
public const int READ_ONLY = 1
Field Value
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
VISIBLE
The field is visible.
public const int VISIBLE = 0
Field Value
VISIBLE_BUT_DOES_NOT_PRINT
The field is visible but does not print.
public const int VISIBLE_BUT_DOES_NOT_PRINT = 2
Field Value
alignment
protected int alignment
Field Value
backgroundColor
protected BaseColor backgroundColor
Field Value
borderColor
protected BaseColor borderColor
Field Value
borderStyle
protected int borderStyle
Field Value
borderWidth
protected float borderWidth
Field Value
box
protected Rectangle box
Field Value
fieldName
Holds value of property fieldName.
protected string fieldName
Field Value
font
protected BaseFont font
Field Value
fontSize
protected float fontSize
Field Value
maxCharacterLength
Holds value of property maxCharacterLength.
protected int maxCharacterLength
Field Value
options
Holds value of property options.
protected int options
Field Value
rotation
Holds value of property rotation.
protected int rotation
Field Value
text
protected string text
Field Value
textColor
protected BaseColor textColor
Field Value
visibility
Holds value of property visibility.
protected int visibility
Field Value
writer
protected PdfWriter writer
Field Value
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
BackgroundColor
Sets the background color. Set to null for transparent background.
public BaseColor BackgroundColor { get; set; }
Property Value
BorderColor
Sets the border color. Set to null to remove the border.
public BaseColor BorderColor { get; set; }
Property Value
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
BorderWidth
Sets the border width in points. To eliminate the border set the border color to null .
public float BorderWidth { get; set; }
Property Value
Box
Sets the field dimension and position.
public Rectangle Box { get; set; }
Property Value
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
Font
Sets the text font. If null then Helvetica will be used.
public BaseFont Font { get; set; }
Property Value
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
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
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
RealFont
protected BaseFont RealFont { get; }
Property Value
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
Text
Sets the text for text fields.
public string Text { get; set; }
Property Value
TextColor
Sets the text color. If null the color used will be black.
public BaseColor TextColor { get; set; }
Property Value
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
Writer
public PdfWriter Writer { get; set; }
Property Value
Methods
BreakLines(List<string>, BaseFont, float, float)
protected static IList<string> BreakLines(List<string> breaks, BaseFont font, float fontSize, float width)
Parameters
Returns
GetBorderAppearance()
protected PdfAppearance GetBorderAppearance()
Returns
GetHardBreaks(string)
protected static IList<string> GetHardBreaks(string text)
Parameters
text
string
Returns
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
PdfDictionarythe source
to
PdfDictionarythe 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
Rectanglethe page
TrimRight(StringBuilder)
protected static void TrimRight(StringBuilder buf)
Parameters
buf
StringBuilder