Class PdfXfaButtonField
Represents the XFA Button Field
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfXfaButtonField : PdfXfaStyledField
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.
Declaration
public PdfXfaButtonField(string name, SizeF buttonSize)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the field |
System.Drawing.SizeF | buttonSize | 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, Single, Single)
Initialize the instance of the PdfXfaButtonField class.
Declaration
public PdfXfaButtonField(string name, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the field |
System.Single | width | Field width |
System.Single | height | 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
Declaration
public string Content { 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 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
Declaration
public PdfHighlightMode Highlight { get; set; }
Property Value
Type |
---|
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
Declaration
public string MouseDownText { 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 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
Declaration
public string MouseRolloverText { 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 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.
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 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()