Table of Contents

Class PdfXfaCaption

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

Represents the Caption of XFA fields

public class PdfXfaCaption
Inheritance
PdfXfaCaption
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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Constructors

PdfXfaCaption()

Initialize the instance of the caption

public PdfXfaCaption()

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

ForeColor

Gets or sets the forecolor of the caption

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

HorizontalAlignment

Gets or sets the horizontal alignment of the caption

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Position

Gets or sets the position of the caption

public PdfXfaPosition Position { get; set; }

Property Value

PdfXfaPosition

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Text

Gets or sets the caption 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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

VerticalAlignment

Gets or sets the vertical alignment of the caption

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Width

Gets or sets the width of the caption

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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.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 textbox field and add the properties.
PdfXfaTextBoxField textBoxField = new PdfXfaTextBoxField("FirstName", new SizeF(200, 20));
//Create new XFA caption instance.
PdfXfaCaption caption = new PdfXfaCaption();
//Set caption text.
caption.Text = "First Name";
//Set the caption font.
caption.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Set the caption fore color.
caption.ForeColor = new PdfColor(Color.Red);
//Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center;
//Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle;
//Set the caption position.
caption.Position = PdfXfaPosition.Left;
//Set the caption reserved width.
caption.Width = 100;
//Set the caption to text box.
textBoxField.Caption = caption;
//Set the tool tip.
textBoxField.ToolTip = "First Name";
//Add the field to the XFA form.
mainForm.Fields.Add(textBoxField);
PdfXfaTextBoxField field1 = new PdfXfaTextBoxField("TextBox1", new SizeF(200, 20));
//Clone the caption.
field1.Caption = caption.Clone() as PdfXfaCaption;
mainForm.Fields.Add(field1);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("output.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 textbox field and add the properties.
Dim textBoxField As New PdfXfaTextBoxField("FirstName", New SizeF(200, 20))
'Create new XFA caption instance.
Dim caption As New PdfXfaCaption()
'Set caption text.
caption.Text = "First Name"
'Set the caption font.
caption.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Set the caption fore color.
caption.ForeColor = New PdfColor(Color.Red)
'Set the horizontal alignment.
caption.HorizontalAlignment = PdfXfaHorizontalAlignment.Center
'Set the vertical alignment.
caption.VerticalAlignment = PdfXfaVerticalAlignment.Middle
'Set the caption position.
caption.Position = PdfXfaPosition.Left
'Set the caption reserved width.
caption.Width = 100
'Set the caption to text box.
textBoxField.Caption = caption
'Set the tool tip.
textBoxField.ToolTip = "First Name"
'Add the field to the XFA form.
mainForm.Fields.Add(textBoxField)
Dim field1 As New PdfXfaTextBoxField("TextBox1", New SizeF(200, 20))
'Clone the caption.
field1.Caption = TryCast(caption.Clone(), PdfXfaCaption)
mainForm.Fields.Add(field1)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()