Table of Contents

Class PdfXfaButtonField

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

Represents the XFA Button Field

public class PdfXfaButtonField : PdfXfaStyledField
Inheritance
PdfXfaButtonField
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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Constructors

PdfXfaButtonField(string, SizeF)

Initialize the instance of the PdfXfaButtonField class.

public PdfXfaButtonField(string name, SizeF buttonSize)

Parameters

name string

Name of the field

buttonSize SizeF

Width and height of the field

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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

PdfXfaButtonField(string, float, float)

Initialize the instance of the PdfXfaButtonField class.

public PdfXfaButtonField(string name, float width, float height)

Parameters

name string

Name of the field

width float

Field width

height float

Field height

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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", 70, 20);
//Set the caption text.
buttonField.Content = "Click";
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", 70, 20)
'Set the caption text.
buttonField.Content = "Click"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Properties

Content

Gets or sets the content of the button field

public string Content { 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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

Highlight

Gets or sets the hightlight mode of the button field

public PdfHighlightMode Highlight { get; set; }

Property Value

PdfHighlightMode

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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push;
//Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered";
//Set mouse down text.
buttonField.MouseDownText = "Mouse pressed";           
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push
'Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered"
'Set mouse down text.
buttonField.MouseDownText = "Mouse pressed"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

MouseDownText

Gets or sets the mouse down text of the button field

public string MouseDownText { 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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push;
//Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered";
//Set mouse down text.
buttonField.MouseDownText = "Mouse pressed";           
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push
'Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered"
'Set mouse down text.
buttonField.MouseDownText = "Mouse pressed"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()

MouseRolloverText

Gets or sets the mouse rollover text

public string MouseRolloverText { 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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", new SizeF(70, 20));
//Set the caption text.
buttonField.Content = "Click";
//Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push;
//Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered";
//Set mouse down text.
buttonField.MouseDownText = "Mouse pressed";           
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", New SizeF(70, 20))
'Set the caption text.
buttonField.Content = "Click"
'Set highlight mode.
buttonField.Highlight = PdfHighlightMode.Push
'Set mouse rollover text.
buttonField.MouseRolloverText = "Mouse entered"
'Set mouse down text.
buttonField.MouseDownText = "Mouse pressed"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.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 button field and add the properties.
PdfXfaButtonField buttonField = new PdfXfaButtonField("buttonField", 70, 20);
//Set the caption text.
buttonField.Content = "Click";
//Add the field to the XFA form.
mainForm.Fields.Add(buttonField);
//Clone the button field.
PdfXfaButtonField clonedButton = buttonField.Clone() as PdfXfaButtonField;
clonedButton.Content = "Submit";
mainForm.Fields.Add(clonedButton);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.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 button field and add the properties.
Dim buttonField As New PdfXfaButtonField("buttonField", 70, 20)
'Set the caption text.
buttonField.Content = "Click"
'Add the field to the XFA form.
mainForm.Fields.Add(buttonField)
'Clone the button field.
Dim clonedButton As PdfXfaButtonField = TryCast(buttonField.Clone(), PdfXfaButtonField)
clonedButton.Content = "Submit"
mainForm.Fields.Add(clonedButton)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic)
'close the document
document.Close()