Skip to main content

Actions

Version: 11.0

dynamic-pdf-actions


title: description:

Actions

DynamicPDF Core Suite supports many actions for achieving many different results. For example, DynamicPDF supports JavaScript actions, URL actions, submit actions, page navigation actions, actions to show/hide fields, actions to open files, and many more actions. Use these actions to perform tasks in many places such as in outlines, links, buttons, or any Document, Page or Form Field Reader Events.

URLAction​

The URLAction supports linking to a web URL destination. The following example demonstrates creating a link that navigates to a specific URL.

UrlAction action = new UrlAction("http://www.mydomain.com");
Link link = new Link(50, 50, Font.Helvetica.GetTextWidth("My Domain", 18), 20, action);
Dim MyAction As UrlAction = New UrlAction("http://www.mydomain.com")
Dim MyLink As Link = New Link(50, 50, Font.Helvetica.GetTextWidth("My Domain", 18), 20, MyAction)

SubmitAction​

The SubmitAction sends form field data to a specified URL. For example, the following code demonstrates how to use a button to post form field data to a URL.

SubmitAction submitAction = new SubmitAction("www.mydomain.com", FormExportFormat.HtmlPost);
Button button = new Button("btn", 50, 300, 100, 50);
button.Label = "Submit";
button.Action = submitAction;
Dim MySubmitAction As SubmitAction = New SubmitAction("www.mydomain.com", FormExportFormat.HtmlPost)
Dim MyButton As Button = New Button("btn", 50, 300, 100, 50)
MyButton.Label = "Submit"
MyButton.Action = MySubmitAction

GoToAction​

The GoToAction moves to a particular page on a PDF document. The following example illustrates using a button to navigate to a specific page.

Button button = new Button("btn", 50, 150, 100, 30);
button.Label = "Click Here";
GoToAction action = new GoToAction(2, PageZoom.FitWidth);
button.ReaderEvents.MouseUp = action;
Dim MyButton As Button = New Button("btn", 50, 150, 100, 30)
MyButton.Label = "Click Here"
Dim MyAction As GoToAction = New GoToAction(2, PageZoom.FitWidth)
MyButton.ReaderEvents.MouseUp = MyAction

AnnotationShowHideAction​

The AnnotationShowHideAction shows/hides a specific form field. The following example illustrates how to use a button to hide a form field.

Button button = new Button("btn", 50, 150, 100, 30);
button.Label = "Click Here";
ceTe.DynamicPDF.PageElements.Forms.TextField field = new ceTe.DynamicPDF.PageElements.Forms.TextField("Text1", 330, 100, 100, 30);
field.DefaultValue = "Text Field Value";
AnnotationShowHideAction action = new AnnotationShowHideAction("Text1");
button.ReaderEvents.MouseDown = action;
Dim MyButton As Button = New Button("btn", 50, 150, 100, 30)
MyButton.Label = "Click Here"
Dim Myfield As ceTe.DynamicPDF.PageElements.Forms.TextField = New ceTe.DynamicPDF.PageElements.Forms.TextField("Text1", 330, 100, 100, 30)
Myfield.DefaultValue = "Text Field Value"
Dim MyAction As AnnotationShowHideAction = New AnnotationShowHideAction("Text1")
MyButton.ReaderEvents.MouseDown = MyAction

FileOpenAction​

The FileOpenAction opens a file, provided a native application to open that specific file is already installed. The following example demonstrates how to open a file using a button click (MouseUp).

Button button = new Button("btn", 50, 150, 100, 30);
button.Label = "Click Here";
FileOpenAction action = new FileOpenAction(@"Path of the file to open", FileLaunchMode.NewWindow);
button.ReaderEvents.MouseUp = action
Dim MyButton As Button = New Button("btn", 50, 150, 100, 30)
MyButton.Label = "Click Here"
Dim MyAction As FileOpenAction = New FileOpenAction("Path of the file to open", FileLaunchMode.NewWindow)
MyButton.ReaderEvents.MouseUp = MyAction

ImportFormDataAction​

The ImportFormDataAction is used to fill form fields by importing data from a FDF file. The following example demonstrates how to import a FDF file with a button click (MouseUp).

Button button = new Button("btn", 50, 150, 100, 30);
button.Label = "Click Here";
ImportFormDataAction action = new ImportFormDataAction(@"FdfFilePath");
button.ReaderEvents.MouseUp = action;
Dim MyButton As Button = New Button("btn", 50, 150, 100, 30)
MyButton.Label = "Click Here"
Dim MyAction As ImportFormDataAction = New ImportFormDataAction("FdfFilePath")
MyButton.ReaderEvents.MouseUp = MyAction

ResetAction​

This ResetAction resets all form field values to their default values. The following example illustrates.

ResetAction action = new ResetAction();
Button button = new Button("btn", 50, 300, 100, 50);
button.Label = "Reset";
button.ReaderEvents.MouseEnter = action;
Dim MyAction As ResetAction = New ResetAction()
Dim MyButton As Button = New Button("btn", 50, 300, 100, 50)
MyButton.Label = "Reset"
MyButton.ReaderEvents.MouseEnter = MyAction

JavaScriptAction​

DynamicPDF Core Suite allows specifying JavaScript code at the document level and the form field level for any PDF.

See the JavaScript topic for more information.