File Formats

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfLoadedTextBoxField

    Show / Hide Table of Contents

    Class PdfLoadedTextBoxField

    Represents the text box field of an existing PDF document.

    Inheritance
    System.Object
    PdfField
    PdfLoadedField
    PdfLoadedStyledField
    PdfLoadedTextBoxField
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfLoadedStyledField.GetGraphicsProperties(PdfLoadedStyledField.GraphicsProperties, PdfLoadedFieldItem)
    PdfLoadedStyledField.DefineDefaultAppearance()
    PdfLoadedStyledField.StyleToString(PdfCheckBoxStyle)
    PdfLoadedStyledField.MouseEnter
    PdfLoadedStyledField.MouseUp
    PdfLoadedStyledField.MouseDown
    PdfLoadedStyledField.MouseLeave
    PdfLoadedStyledField.GotFocus
    PdfLoadedStyledField.LostFocus
    PdfLoadedStyledField.Bounds
    PdfLoadedStyledField.Location
    PdfLoadedStyledField.Size
    PdfLoadedStyledField.BorderStyle
    PdfLoadedStyledField.BorderColor
    PdfLoadedStyledField.BorderWidth
    PdfLoadedStyledField.Font
    PdfLoadedStyledField.DefaultIndex
    PdfLoadedStyledField.Visible
    PdfLoadedStyledField.Visibility
    PdfLoadedStyledField.RotationAngle
    PdfLoadedField.ObjectID
    PdfLoadedField.SetName(String)
    PdfLoadedField.Name
    PdfLoadedField.MappingName
    PdfLoadedField.ToolTip
    PdfLoadedField.Page
    PdfLoadedField.ReadOnly
    PdfLoadedField.Required
    PdfLoadedField.Export
    PdfLoadedField.Form
    PdfField.Initialize()
    PdfField.Flatten
    PdfField.DisableAutoFormat
    PdfField.PdfTag
    PdfField.TabIndex
    PdfField.Layer
    PdfField.PropertyChanged
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf.Parsing
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfLoadedTextBoxField : PdfLoadedStyledField, IPdfWrapper, INotifyPropertyChanged
    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Load the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    RectangleF newBounds = new RectangleF(100, 100, 50, 50);
    ldField.Bounds = newBounds;
    ldField.SpellCheck = true;
    ldField.Text = "New text of the field.";
    ldField.Password = false;
    ldField.BorderStyle = PdfBorderStyle.Dashed;
    doc.Save("LoadedForm.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Load the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    Dim newBounds As RectangleF = New RectangleF(100, 100, 50, 50)
    ldField.Bounds = newBounds
    ldField.SpellCheck = True
    ldField.Text = "New text of the field."
    ldField.Password = False
    ldField.BorderStyle = PdfBorderStyle.Dashed
    doc.Save("LoadedForm.pdf")
    doc.Close(True)

    Properties

    AutoResizeText

    Declaration
    public bool AutoResizeText { get; set; }
    Property Value
    Type Description
    System.Boolean

    BackColor

    Get or Set the back color of the field

    Declaration
    public PdfColor BackColor { get; set; }
    Property Value
    Type Description
    PdfColor

    A PdfColor object specifying the background color of field.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field.
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.BackColor = new PdfColor(Color.Transparent);
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.BackColor = New PdfColor(Color.Transparent)
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument
    PdfColor

    ComplexScript

    Gets or sets the complex script language support.

    Declaration
    public bool ComplexScript { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Load existing PDF document.
    PdfLoadedDocument ldoc = new PdfLoadedDocument("form.pdf");
    //Load the existing text box field.
    PdfLoadedTextBoxField textField = ldoc.Form.Fields[0] as PdfLoadedTextBoxField;
    //Create font.
    Font font = new Font("Tahoma", 10f);
    //Create a new PDF font instance.
    PdfFont pdfFont = new PdfTrueTypeFont(font, FontStyle.Regular, 10f, true, true);
    //Set font.
    textField.Font = pdfFont;
    //Enable complex script support.
    textField.ComplexScript = true;
    ldoc.Form.SetDefaultAppearance(false);
    //Save the document.
    ldoc.Save("output.pdf");
    //Close the document.
    ldoc.Close(true);
    'Load existing PDF document.
    Dim ldoc As New PdfLoadedDocument("form.pdf")
    'Load the existing text box field.
    Dim textField As PdfLoadedTextBoxField = TryCast(ldoc.Form.Fields(0), PdfLoadedTextBoxField)
    'Create font.
    Dim font As New Font("Tahoma", 10F)
    'Create a new PDF font instance.
    Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, FontStyle.Regular, 10F, True, True)
    'Set font.
    textField.Font = pdfFont
    'Enable complex script support.
    textField.ComplexScript = True
    ldoc.Form.SetDefaultAppearance(False)
    'Save the document.
    ldoc.Save("output.pdf")
    'Close the document.
    ldoc.Close(True)

    DefaultValue

    Declaration
    public string DefaultValue { get; set; }
    Property Value
    Type Description
    System.String

    ForeColor

    Gets or Set the fore color of the field.

    Declaration
    public virtual PdfColor ForeColor { get; set; }
    Property Value
    Type Description
    PdfColor

    A PdfColor object specifying the background color of field.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field.
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.ForeColor = new PdfColor(Color.Red);
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field.
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.ForeColor = New PdfColor(Color.Red)
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument
    PdfColor

    HighlightMode

    Get or Set the HighLightMode of the Field.

    Declaration
    public PdfHighlightMode HighlightMode { get; set; }
    Property Value
    Type Description
    PdfHighlightMode

    A PdfHighlightMode enumeration member specifying the highlight mode in a text box.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Load the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.HighlightMode = PdfHighlightMode.Push;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Load the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.HighlightMode = PdfHighlightMode.Push
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument
    PdfHighlightMode

    InsertSpaces

    Meaningful only if the MaxLength property is set and the Multiline, Password properties are false. If set, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLength, and the text is laid out into those combs.

    Declaration
    public bool InsertSpaces { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.InsertSpaces = true;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.InsertSpaces = True
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    IsAutoFontSize

    Declaration
    public bool IsAutoFontSize { get; }
    Property Value
    Type Description
    System.Boolean

    Items

    Gets the collection of text box field items.[Read-Only]

    Declaration
    public PdfLoadedTextBoxItemCollection Items { get; }
    Property Value
    Type Description
    PdfLoadedTextBoxItemCollection
    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField textboxField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    // TextBox Item collection
    PdfLoadedTextBoxItemCollection textboxFieldCollection = textboxField.Items;
    textboxFieldCollection[0].Location = new PointF(10, 20);
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim textboxField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ' TextBox Item collection
    Dim textboxFieldCollection As PdfLoadedTextBoxItemCollection = textboxField.Items
    textboxFieldCollection(0).Location = New PointF(10, 20)
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    MaxLength

    Gets or sets the maximum length of the field, in characters.

    Declaration
    public int MaxLength { get; set; }
    Property Value
    Type Description
    System.Int32

    A positive integer value specifying the maximum number of characters that can be entered in the text edit field.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.MaxLength = 10;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.MaxLength = 10
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    Multiline

    Gets or sets a value indicating whether this PdfTextBoxField is multiline.

    Declaration
    public bool Multiline { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if the field is multiline, false otherwise. Default is false.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.Multiline = true;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.Multiline = True
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    Password

    Gets or sets a value indicating whether this PdfTextBoxField is password field.

    Declaration
    public bool Password { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if the field is a password field, false otherwise. Default is false.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.Password = true;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.Password = True
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    Scrollable

    Gets or sets a value indicating whether this PdfTextBoxField is scrollable.

    Declaration
    public bool Scrollable { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if the field content can be scrolled, false otherwise. Default is true.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.Scrollable = true;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.Scrollable = True
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    SpellCheck

    Gets or sets a value indicating whether to check spelling.

    Declaration
    public bool SpellCheck { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if the field content should be checked for spelling erorrs, false otherwise. Default is true.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.SpellCheck = true;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.SpellCheck = True
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    Text

    Gets or Set value of the text box field.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    A string value representing the value of the item.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.Text = "New Text";
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.Text = "New Text"
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument

    TextAlignment

    Get or Set the text alignment in a text box.

    Declaration
    public PdfTextAlignment TextAlignment { get; set; }
    Property Value
    Type Description
    PdfTextAlignment

    A PdfTextAlignment enumeration member specifying the text alignment in a text box.

    Examples
    //Load an existing document
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Read the text box field.
    PdfLoadedTextBoxField ldField = doc.Form.Fields[0] as PdfLoadedTextBoxField;
    ldField.TextAlignment = PdfTextAlignment.Justify;
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Read the text box field.
    Dim ldField As PdfLoadedTextBoxField = TryCast(doc.Form.Fields(0), PdfLoadedTextBoxField)
    ldField.TextAlignment = PdfTextAlignment.Justify
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedDocument
    PdfTextAlignment

    Methods

    Remove(PdfLoadedTexBoxItem)

    Declaration
    public void Remove(PdfLoadedTexBoxItem item)
    Parameters
    Type Name Description
    PdfLoadedTexBoxItem item

    RemoveAt(Int32)

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    PdfLoadedDocument
    PdfLoadedStyledField
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved