TextField

Represents the text field of a interactive forms. Text fields are boxes or spaces in which the user can enter text from the keyboard.

public class TextField : FormElement, ISerializable
Public Class TextField
    Inherits FormElement
    Implements ISerializable

Inheritance: ObjectPageElementTaggablePageElementFormElementTextField

Implements: ISerializable

Derived: RichTextField

Licensing Info

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to create an Text Field and Add it to the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.Forms
Imports ceTe.DynamicPDF.Text
     
Module MyModule
     		
    Sub Main()
     		
        ' Create a PDF Document
        Dim MyDocument As Document = New Document
     		
        ' Create a PDF Page
        Dim MyPage As Page = New Page(PageSize.Letter)
     		
        ' Create an Text Field
        Dim MyTextField As TextField = New TextField("txt", 50, 75, 150, 100)
        MyTextField.TextAlign = Align.Center
        MyTextField.BackgroundColor = RgbColor.AliceBlue
        MyTextField.BorderColor = RgbColor.DeepPink
        Dim MyFont As OpenTypeFont = new OpenTypeFont("fontname")
        MyTextField.Font = MyFont
        MyTextField.FontSize = 16.0f
        MyTextField.TextColor = RgbColor.Brown
        MyTextField.DefaultValue = "Hello World."
        MyTextField.MultiLine = true
        MyTextField.ToolTip = "Text"
     		
        ' Add the Text Field to the page
        MyPage.Elements.Add(MyTextField)
     		
        ' Add pages to the document
        MyDocument.Pages.Add(MyPage)
     
        ' Save the PDF document
        MyDocument.Draw("C:\MyDocument.pdf")
     		
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Forms;
using ceTe.DynamicPDF.Text;

public class Example
{
    public static void CreatePDF(string outputPath, string fontPath)
    {
        // Create a PDF Document
        Document document = new Document();

        //Set PDF version to 1.6
        document.PdfVersion = PdfVersion.v1_6;

        // Create a PDF Page
        Page page = new Page(PageSize.Letter);

        // Create an Text Field
        TextField textField = new TextField("txt", 50, 75, 150, 100);
        textField.TextAlign = Align.Center;
        textField.BackgroundColor = RgbColor.AliceBlue;
        textField.BorderColor = RgbColor.DeepPink;
        OpenTypeFont myFont = new OpenTypeFont(fontPath);
        textField.Font = myFont;
        textField.FontSize = 16.0f;
        textField.TextColor = RgbColor.Brown;
        textField.DefaultValue = "Hello World.";
        textField.MultiLine = true;
        textField.ToolTip = "Text";

        // Add the Text Field to the page
        page.Elements.Add(textField);

        // Add pages to the document
        document.Pages.Add(page);

        // Save the PDF document
        document.Draw(outputPath);
    }
}

Remarks

For more details on text fields take a look at the Interactive Forms topic.

Constructors

TextField(String, Single, Single, Single, Single)Creates a new instance of TextField class.

Properties

BackgroundColorGets or Sets the fill/background color of a form field.
(Inherited from FormElement)
BorderColorGets or Sets the border color of a form field.
(Inherited from FormElement)
BorderStyleGets or Sets the BorderStyle .
(Inherited from FormElement)
CombGets or Sets the text field to be comb.
DefaultValueGets or Sets the text field's default value.
FontGets or Sets the font for the field.
FontSizeGets or Sets the font size for the field.
HeightGets or Sets the height of a form field.
(Inherited from FormElement)
IDGets or sets the ID of the page element.
(Inherited from PageElement)
IgnoreMarginsGets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property.
(Inherited from PageElement)
MappingNameGets or Sets an mapping name, of a form field.
(Inherited from FormElement)
MaxLengthGets or Sets the maximum length of characters in a text field.
MultiLineGets or Sets the text field to contain multiple lines. If set, the field may contain multiple lines of text; if clear, the field?s text is restricted to a single line.
NameGets or Sets the name of a form field.
(Inherited from FormElement)
NoExportGets or Sets the export state for the field. If set, the field will not be exported by a submit-form action.
OutputGets or sets output options for the field.
(Inherited from FormElement)
PasswordGets or Sets the text field intended for entering a secure password that should not be echoed visibly to the screen.
PrintableGets or Sets the form field printable on Pdf. By default its true.
(Inherited from FormElement)
ReaderEventsGets the reader events of the annotation.
(Inherited from FormElement)
ReadOnlyGets or Sets the read only property status of the form field.
(Inherited from FormElement)
RelativeToGets and sets placement of the page element on the page.
(Inherited from PageElement)
RequiredGets or Sets the required state for the field. If set, the field must have a value at the time it is exported by a submit-form action.
RotateGets or Sets the angle of a form field. Rotation angle should be multiple of 90, default is 0.
(Inherited from FormElement)
TagGets or sets the structure element of the form element.
(Inherited from FormElement)
TagOrderGets or sets the tag order of the taggable element.
(Inherited from TaggablePageElement)
TextAlignSets the text align.
TextColorGets or Sets the color of the text for the field.
(Inherited from FormElement)
ToolTipGets or Sets an alternate field name, of a form field.
(Inherited from FormElement)
VisibleGets or Sets the form field visible on Pdf. By default its true.
(Inherited from FormElement)
WidthGets or Sets the width of a form field.
(Inherited from FormElement)
XGets or Sets the X coordinate of a form field.
(Inherited from FormElement)
YGets or Sets the Y coordinate of a form field.
(Inherited from FormElement)

Methods

Draw(PageWriter)Draws the text field to the given PageWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.PageElements.Forms

In this topic