menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfXfaCaption - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfXfaCaption

    Represents the Caption of XFA fields

    Inheritance
    System.Object
    PdfXfaCaption
    Namespace: Syncfusion.Pdf.Xfa
    Assembly: Syncfusion.Pdf.UWP.dll
    Syntax
    public class PdfXfaCaption : Object
    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

    Declaration
    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

    Declaration
    public PdfFont Font { set; }
    Property Value
    Type
    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

    Declaration
    public PdfColor ForeColor { get; set; }
    Property Value
    Type
    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

    Declaration
    public PdfXfaHorizontalAlignment HorizontalAlignment { get; set; }
    Property Value
    Type
    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

    Declaration
    public PdfXfaPosition Position { get; set; }
    Property Value
    Type
    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

    Declaration
    public string Text { get; set; }
    Property Value
    Type
    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 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

    Declaration
    public PdfXfaVerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type
    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

    Declaration
    public float Width { get; set; }
    Property Value
    Type
    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 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.

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

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved