Class PdfFieldActions
Represents actions to be performed as response to field events.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfFieldActions : IPdfWrapper
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
Constructors
PdfFieldActions(PdfAnnotationActions)
Initializes a new instance of the PdfFieldActions class with PdfAnnotationActions
Declaration
public PdfFieldActions(PdfAnnotationActions annotationActions)
Parameters
Type | Name | Description |
---|---|---|
PdfAnnotationActions | annotationActions |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
See Also
Properties
Calculate
Gets or sets the JavaScript action to be performed to recalculate the value of this field when that of another field changes.
Declaration
public PdfJavaScriptAction Calculate { get; set; }
Property Value
Type | Description |
---|---|
PdfJavaScriptAction | A PdfJavaScriptAction object specifying the action to be executed for calculating the field value. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Apply";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new PdfJavaScriptAction
PdfJavaScriptAction javaAction = new PdfJavaScriptAction("app.alert(\"You are looking at Java script action of PDF \")");
//Set the javaAction to submitButton
submitButton.Actions.Calculate = javaAction;
//Add the submit button to the new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("JavaScriptAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Apply"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new PdfJavaScriptAction
Dim javaAction As New PdfJavaScriptAction("app.alert(""You are looking at Java script action of PDF "")")
'Set the javaAction to submitButton
submitButton.Actions.Calculate = javaAction
'Add the submit button to the new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("JavaScriptAction.pdf")
'close the document.
document.Close(True)
See Also
Format
Gets or sets the JavaScript action to be performed before the field is formatted to display its current value. This action can modify the field�s value before formatting.
Declaration
public PdfJavaScriptAction Format { get; set; }
Property Value
Type | Description |
---|---|
PdfJavaScriptAction | A PdfJavaScriptAction object specifying the action to be executed for formatting the field value. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Apply";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new PdfJavaScriptAction
PdfJavaScriptAction javaAction = new PdfJavaScriptAction("app.alert(\"You are looking at Java script action of PDF \")");
//Set the javaAction to submitButton
submitButton.Actions.Format = javaAction;
//Add the submit button to the new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("JavaScriptAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Apply"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new PdfJavaScriptAction
Dim javaAction As New PdfJavaScriptAction("app.alert(""You are looking at Java script action of PDF "")")
'Set the javaAction to submitButton
submitButton.Actions.Format = javaAction
'Add the submit button to the new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("JavaScriptAction.pdf")
'close the document.
document.Close(True)
See Also
GotFocus
Gets or sets the action to be performed when the field receives the input focus.
Declaration
public PdfAction GotFocus { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction specifying the action to be executed when the field receives the input focus. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.GotFocus = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.GotFocus = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
close the document.
document.Close(True)
See Also
KeyPressed
Gets or sets the JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box. This action can check the keystroke for validity and reject or modify it.
Declaration
public PdfJavaScriptAction KeyPressed { get; set; }
Property Value
Type | Description |
---|---|
PdfJavaScriptAction | A PdfJavaScriptAction object specifying the action to be executed when the user types a keystroke. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Apply";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new PdfJavaScriptAction
PdfJavaScriptAction javaAction = new PdfJavaScriptAction("app.alert(\"You are looking at Java script action of PDF \")");
//Set the javaAction to submitButton
submitButton.Actions.KeyPressed = javaAction;
//Add the submit button to the new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("JavaScriptAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Apply"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new PdfJavaScriptAction
Dim javaAction As New PdfJavaScriptAction("app.alert(""You are looking at Java script action of PDF "")")
'Set the javaAction to submitButton
submitButton.Actions.KeyPressed = javaAction
'Add the submit button to the new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("JavaScriptAction.pdf")
'close the document.
document.Close(True)
See Also
LostFocus
Gets or sets the action to be performed when the field loses the input focus.
Declaration
public PdfAction LostFocus { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction specifying the action to be executed when the field losts the input focus. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.LostFocus = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.LostFocus = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
See Also
MouseDown
Gets or sets the action to be performed when the mouse button is pressed inside the field�s area.
Declaration
public PdfAction MouseDown { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction specifying the action to be executed when the mouse button is pressed inside the field's area. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseDown = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseDown = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
See Also
MouseEnter
Gets or sets the action to be performed when the mouse cursor enters the fields�s area.
Declaration
public PdfAction MouseEnter { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction specifying the action to be executed when the mouse enters the field's area. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseEnter = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseEnter = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
See Also
MouseLeave
Gets or sets the action to be performed when the cursor exits the fields�s area.
Declaration
public PdfAction MouseLeave { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction descendant specifying the action to be executed when the mouse leaves the field's area. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseLeave = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
'close the document.
document.Close(True)
See Also
MouseUp
Gets or sets the action to be performed when the mouse button is released inside the field�s area.
Declaration
public PdfAction MouseUp { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | A PdfAction specifying the action to be executed when the mouse button is released inside the field's area. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Launch";
//Create a new PdfLaunchAction
PdfLaunchAction launchAction = new PdfLaunchAction(@"..\..\Data\Sample.txt");
//Set the launch action to submit button
submitButton.Actions.MouseUp = launchAction;
//Add the submit button to a new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("LaunchAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Launch"
'Create a new PdfLaunchAction
Dim launchAction As New PdfLaunchAction("..\..\Data\Sample.txt")
'Set the launch action to submit button
submitButton.Actions.MouseUp = launchAction
'Add the submit button to a new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("LaunchAction.pdf")
close the document.
document.Close(True)
See Also
Validate
Gets or sets the JavaScript action to be performed when the field�s value is changed. This action can check the new value for validity.
Declaration
public PdfJavaScriptAction Validate { get; set; }
Property Value
Type | Description |
---|---|
PdfJavaScriptAction | A PdfJavaScriptAction object specifying the action to be executed for validating the field value. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create a new PdfButtonField
PdfButtonField submitButton = new PdfButtonField(page, "submitButton");
submitButton.Bounds = new RectangleF(25, 160, 100, 20);
submitButton.Text = "Apply";
submitButton.BackColor = new PdfColor(181, 191, 203);
//Create a new PdfJavaScriptAction
PdfJavaScriptAction javaAction = new PdfJavaScriptAction("app.alert(\"You are looking at Java script action of PDF \")");
//Set the javaAction to submitButton
submitButton.Actions.Validate = javaAction;
//Add the submit button to the new document.
document.Form.Fields.Add(submitButton);
//Save document to disk.
document.Save("JavaScriptAction.pdf");
//close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create a new PdfButtonField
Dim submitButton As New PdfButtonField(page, "submitButton")
submitButton.Bounds = New RectangleF(25, 160, 100, 20)
submitButton.Text = "Apply"
submitButton.BackColor = New PdfColor(181, 191, 203)
'Create a new PdfJavaScriptAction
Dim javaAction As New PdfJavaScriptAction("app.alert(""You are looking at Java script action of PDF "")")
'Set the javaAction to submitButton
submitButton.Actions.Validate = javaAction
'Add the submit button to the new document.
document.Form.Fields.Add(submitButton)
'Save document to disk.
document.Save("JavaScriptAction.pdf")
'close the document.
document.Close(True)