Enum PdfXfaHorizontalAlignment
Specifies Horizontal alignment
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public enum 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()
Fields
Name | Description |
---|---|
Center | Specifies the element is aligned to Center. |
Justify | Specifies the element is aligned with Justify |
JustifyAll | Spread-justify all lines to fill the available region. |
Left | Specifies the element is aligned to Left. |
Right | Specifies the element is aligned to Right. |