Table of Contents

Class PdfXfaTextElement

Namespace
Syncfusion.Pdf.Xfa
Assembly
Syncfusion.Pdf.Portable.dll

Represents text field in the XFA form.

public class PdfXfaTextElement : PdfXfaField
Inheritance
PdfXfaTextElement
Inherited Members

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.

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.

public PdfXfaTextElement(string text)

Parameters

text string

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.

public PdfXfaTextElement(string text, PdfFont font)

Parameters

text string

value of the text element

font PdfFont

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, float, float)

Initializes a new instance of the PdfXfaTextElement class.

public PdfXfaTextElement(string text, PdfFont font, float width, float height)

Parameters

text string

value of the text element

font PdfFont

Font of the text element

width float
height float

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, float, float)

Initialize a new instance of the PdfXfaTextElement class.

public PdfXfaTextElement(string text, float width, float height)

Parameters

text string

Value of the text element

width float

Text element width.

height float

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

public PdfFont Font { get; set; }

Property Value

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

public PdfColor ForeColor { get; set; }

Property Value

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

public float Height { get; set; }

Property Value

float

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

public PdfXfaHorizontalAlignment HorizontalAlignment { get; set; }

Property Value

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

public PdfXfaRotateAngle Rotate { get; set; }

Property Value

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

public string Text { get; set; }

Property Value

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

public PdfXfaVerticalAlignment VerticalAlignment { get; set; }

Property Value

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

public float Width { get; set; }

Property Value

float

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.

public object Clone()

Returns

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()