Interactive Forms Overview

An interactive form, sometimes referred to as an AcroForm, is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields, appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.

You can only have one form per PDF document.

When you design your form, consider if you wish the user to save it, submit it via HTTP, or print the completed form Also consider if you wish the end-user to digitally sign the form. Core Suite supports all these action.

Creating a Form

There is no "Form" element that needs to be created, to create a form you simply add form elements. A form can be a single page or span multiple pages. They are all considered one form.

Form Elements

The FormElement class is parent to the following derived classes: Button, CheckBox, ChoiceField, ComboBox, ListBox, RadioButton, Signature, and TextField. Add one or more of these elements to your form.

Do not confuse the FormElement class with the FormField class and its child classes! The FormField class and its children are for working with pre-existing forms, not creating new forms. See AcroForms Overview for working with existing forms.

Refer to the Interactive Forms Elements documentation page for more information on available form elements.

End-User Interaction

When creating your form, an end user could use their PDF reader to save the completed PDF. However, Core Suite also allows you to make your forms interactive. An end-user can digitally sign a completed form for example. Also, you can add interactivity to a Button using its Action property and its Behavior property. The Action class has numerous subclasses including opening a file (FileOpenAction), resetting a form's content to its default (ResetAction), and submitting a form (SubmitAction), and even custom JavaScript (JavaScriptAction).

Refer to the Actions documentation for more information on actions that can be performed.

Emailing a Form

Be certain to test on a variety of end-user PDF readers and local email accounts. This example was tested on Windows 11 Pro with Outlook Classic as the default mail client.

string bodyMsg = "Thank you for submitting this form.";
string javascriptString = "var cEmailURL = \"mailto:myname@mydomain.com?subject='Form Submission'&body='" + bodyMsg + "'\";";
            javascriptString += " this.submitForm({ cURL: encodeURI(cEmailURL), cSubmitAs: 'PDF', cCharSet: 'utf-8'});";

Button button = new Button("email", 125,700, 100, 20);
button.BackgroundColor = RgbColor.Yellow;
button.BorderStyle = BorderStyle.Beveled;
button.Action = new JavaScriptAction(javascriptString);
button.Label = "Email";
document.Pages[0].Elements.Add(button);
Dim bodyMsg As String = "Thank you for submitting this form."
Dim javascriptString As String = "var cEmailURL = ""mailto:myaddress@mydomain.com?subject='Form Submission'&body='" & bodyMsg & "'"";"
            javascriptString += " this.submitForm({ cURL: encodeURI(cEmailURL), cSubmitAs: 'PDF', cCharSet: 'utf-8'});"

Dim button As New Button("email", 125, 700, 100, 20)
button.BackgroundColor = RgbColor.Yellow
button.BorderStyle = BorderStyle.Beveled
button.Action = New JavaScriptAction(javascriptString)
button.Label = "Email"
document.Pages(0).Elements.Add(button)

Refer to the JavaScriptAction API documentation and the JavaScript documentation.

Submitting a Form

You can also create a PDF form that allows clients to submit their completed form to a webserver. Refer to Actions for more information on submitting interactive forms to a webserver.

If your end-user's PDF reader is Acrobat Reader, the server response must be in in Forms Data Format.

In this topic