WPF

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

    Show / Hide Table of Contents

    Class PdfXfaTextElement

    Represents text field in the XFA form.

    Inheritance
    System.Object
    PdfXfaField
    PdfXfaTextElement
    Inherited Members
    PdfXfaField.Name
    PdfXfaField.Margins
    PdfXfaField.Visibility
    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.Xfa
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfXfaTextElement : PdfXfaField
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!");
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!")
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Constructors

    PdfXfaTextElement()

    Initializes a new instance of the PdfXfaTextElement class.

    Declaration
    public PdfXfaTextElement()
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    PdfXfaTextElement(String)

    Initializes a new instance of the PdfXfaTextElement class.

    Declaration
    public PdfXfaTextElement(string text)
    Parameters
    Type Name Description
    System.String text

    value of the text element

    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!");
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!")
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    PdfXfaTextElement(String, PdfFont)

    Initializes a new instance of the PdfXfaTextElement class.

    Declaration
    public PdfXfaTextElement(string text, PdfFont font)
    Parameters
    Type Name Description
    System.String text

    value of the text element

    PdfFont font

    Font of the text element

    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!", new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold));      
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!", New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold))     
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    PdfXfaTextElement(String, PdfFont, Single, Single)

    Initializes a new instance of the PdfXfaTextElement class.

    Declaration
    public PdfXfaTextElement(string text, PdfFont font, float width, float height)
    Parameters
    Type Name Description
    System.String text

    value of the text element

    PdfFont font

    Font of the text element

    System.Single width
    System.Single height
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!", new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold), 200, 20);      
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!", New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold), 200, 20)     
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    PdfXfaTextElement(String, Single, Single)

    Initialize a new instance of the PdfXfaTextElement class.

    Declaration
    public PdfXfaTextElement(string text, float width, float height)
    Parameters
    Type Name Description
    System.String text

    Value of the text element

    System.Single width

    Text element width.

    System.Single height

    Text element height.

    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!", 200, 20);
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!", 200, 20)
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Properties

    Font

    Gets or sets the font

    Declaration
    public PdfFont Font { get; set; }
    Property Value
    Type Description
    PdfFont
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!");
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!")
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()

    ForeColor

    Gets or sets the fore color of the field

    Declaration
    public PdfColor ForeColor { get; set; }
    Property Value
    Type Description
    PdfColor
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Height

    Gets or sets height of the TextBox

    Declaration
    public float Height { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    HorizontalAlignment

    Gets or sets the Horizontal alignment

    Declaration
    public PdfXfaHorizontalAlignment HorizontalAlignment { get; set; }
    Property Value
    Type Description
    PdfXfaHorizontalAlignment
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Rotate

    Gets or sets the rotation angle

    Declaration
    public PdfXfaRotateAngle Rotate { get; set; }
    Property Value
    Type Description
    PdfXfaRotateAngle
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Text

    Gets or sets the text

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    VerticalAlignment

    Gets or sets the vertical alignment

    Declaration
    public PdfXfaVerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type Description
    PdfXfaVerticalAlignment
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Width

    Gets or sets width of the TextBox

    Declaration
    public float Width { get; set; }
    Property Value
    Type Description
    System.Single
    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement();
    //Set text.
    textElement.Text = "Hello World!.";
    //Set width.
    textElement.Width = 200;
    //Set height.
    textElement.Height = 20;
    //Set fore color.
    textElement.ForeColor = Color.Yellow;
    //Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
    //Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
    //Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90;
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement()
    'Set text.
    textElement.Text = "Hello World!."
    'Set width.
    textElement.Width = 200
    'Set height.
    textElement.Height = 20
    'Set fore color.
    textElement.ForeColor = Color.Yellow
    'Set vertical alignment.
    textElement.VerticalAlignment = PdfXfaVerticalAlignment.Middle
    'Set horizontal alignment.
    textElement.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
    'Set the rotatio angle.
    textElement.Rotate = PdfXfaRotateAngle.RotateAngle90
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
    'close the document
    document.Close()

    Methods

    Clone()

    Creates a new object that is a copy of the current instance.

    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

    The copy of the new object for this instance.

    Examples
    //Create a new PDF XFA document.
    PdfXfaDocument document = new PdfXfaDocument();
    //Add a new XFA page.
    PdfXfaPage xfaPage = document.Pages.Add();
    //Create a new PDF XFA form
    PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
    //Create a text element and add the properties.
    PdfXfaTextElement textElement = new PdfXfaTextElement("Hello World!");
    //Set font
    textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold);
    //Add the text element to the XFA form.
    mainForm.Fields.Add(textElement);
    //Clone the element.
    mainForm.Fields.Add(textElement.Clone() as PdfXfaTextElement);
    //Add the XFA form to the document.
    document.XfaForm = mainForm;
    //Save the document.
    document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
    //close the document
    document.Close();
    'Create a new PDF XFA document.
    Dim document As New PdfXfaDocument()
    'Add a new XFA page.
    Dim xfaPage As PdfXfaPage = document.Pages.Add()
    'Create a new PDF XFA form
    Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
    'Create a text element and add the properties.
    Dim textElement As New PdfXfaTextElement("Hello World!")
    'Set font
    textElement.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle.Bold)
    'Add the text element to the XFA form.
    mainForm.Fields.Add(textElement)
    'Clone the element.
    mainForm.Fields.Add(TryCast(textElement.Clone(), PdfXfaTextElement)
    'Add the XFA form to the document.
    document.XfaForm = mainForm
    'Save the document.
    document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
    'close the document
    document.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved