Class PdfXfaHorizontalAlignment
Specifies Horizontal alignment
Inheritance
System.Object
PdfXfaHorizontalAlignment
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public sealed class PdfXfaHorizontalAlignment : Enum
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
Center
Specifies the element is aligned to Center.
Declaration
public const PdfXfaHorizontalAlignment Center
Field Value
Type |
---|
PdfXfaHorizontalAlignment |
Justify
Specifies the element is aligned with Justify
Declaration
public const PdfXfaHorizontalAlignment Justify
Field Value
Type |
---|
PdfXfaHorizontalAlignment |
JustifyAll
Spread-justify all lines to fill the available region.
Declaration
public const PdfXfaHorizontalAlignment JustifyAll
Field Value
Type |
---|
PdfXfaHorizontalAlignment |
Left
Specifies the element is aligned to Left.
Declaration
public const PdfXfaHorizontalAlignment Left
Field Value
Type |
---|
PdfXfaHorizontalAlignment |
Right
Specifies the element is aligned to Right.
Declaration
public const PdfXfaHorizontalAlignment Right
Field Value
Type |
---|
PdfXfaHorizontalAlignment |