menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Enum PdfXfaPosition - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Enum PdfXfaPosition

    Specifies the caption text position of fields

    Namespace: Syncfusion.Pdf.Xfa
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public enum 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()

    Fields

    Name Description
    Bottom

    Bottom of the field

    Left

    Left side of the field

    Right

    Right side of the field

    Top

    Top of the field

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