Adobe Acrobat Reader and Forms Data without Custom CGI


Adobe Acrobat, Forms and Email; no custom CGI

Adobe Acrobat 5.0 permits the submission of form data via an email connection. However, the free Adobe Acrobat Reader does not permit the submission of form data to via an email message, directly out of the application. Or does it?

As I get this question about once a week, I decided to research and write a small article about how to implement this using Adobe Acrobat here.

There are two solutions: either code your own CGI script in a variety of languages: PERL, PHP, ASP, JSP etc (see: PDF Forms and Javascript), or alternatively use one of the most common pre-installed CGIs: Formmail.

Programming CGI is not a simple “Learn programming CGI in 24-hours” topic. There is a smarter way: by using a CGI that has been “previously cooked in the oven”. Most ISPs and web hosting organisations know that expecting every customer to be a code-jockey is a little steep, therefore they install some default CGIs. “Formmail.cgi” is a simple CGI that takes form data, and emails the result to a nominated email account.

What is Formmail?

From Matt Wright’s Formmail: FormMail is a generic HTML form to e-mail gateway that parses the results of any HTML form and sends them to the specified users. This script has many formatting and operational options, most of which can be specified within each form, meaning you don't need programming knowledge or multiple scripts for multiple forms.

As this is an extremely common CGI, you should be able to get your ISP or web server administrator to install it; or at least a CGI that replicates its functionality. Hostforweb is my third ISP/host since early 2002 and each of the previous two also had a Formmail CGI facility.

So how does CGI and HTML forms relate to Adobe PDF?

Normally, this CGI relies on HTML forms. But aren’t we talking about PDF Forms? With Acrobat, one of the submission formats for forms data is HTML encoded data being received by a CGI. All we need to do is ensure that we submit the PDF form data in a HTML format; and submit fields that the Formmail CGI recognises.

This also does not require any special configuration of email application on the client end. All they need is Acrobat Reader/Adobe Reader installed.

How to Create the Form in Acrobat

Let’s take the example form: a simple web site feedback form for this site. I’ll set up this the forms submission occur via CGI-Formmail.

Download the form here: Feedback Form. Open in Adobe/Acrobat Reader and complete the form.

This form is a simple feedback form. If you click on the Submit button, it will send me an email that looks something like this:

[1352] email_response.gif

The creation of form fields in Acrobat is simple: just use the Form tool, creating text fields in the places you would like them to appear.

Behind the scenes on this form live 3 hidden fields. It is extremely important to name the fields with the required names for the CGI. These fields are sent to the CGI and are used to inform the CGI where to send the data, the subject on the email, who the form is sent from. In Formmail’s instance, its needs at least one field: recipient. In my example, I have added two extra fields: subject (this will be the subject of the email sent to me) and redirect (this is where the CGI will return the user once it has sent the email)

[1353] hiddenfields.jpg

Below, I have clicked on the field “recipient” There are two important things I have configured on this field: firstly, the fact that it is “hidden” – you cannot see it when you are entering data into the form. The second change I have made is to set a default value: the recipient of the form data.

[1354] recipient.gif

The Submit button has special options. When you create the button, in the Actions I have created a “mouse up, Submit Form” action as below:

[1355] submit-1.gif

[1356] submit-2.gif

When you edit the Action, you can nominate the URL. In my instance, the URL is http://thedigitalcottage.com/cgi-sys/FormMail.cgi. This URL WILL NOT WORK in your form – you will need to determine from your hosting provider the URL to their Formmail installation. There are some special anti-SPAM features in Formmail that does not permit the use of my CGI with your site. To have the PDF form submit the data in a format that Formmail can understand, its important that the Export Format is HTML.

One of the Anti-SPAM features of Formmail is restricting who can be the recipient of a particular form. You will need to consult with your ISP to determine what security settings they have applied to their Formmail installation to restrict who the data from the form can be sent to.

Once completed, you load the PDF form or email the form in the normal manner.

Now the final user of the form will be able to Submit data back, without the need of a custom CGI script.

4 thoughts on “Adobe Acrobat Reader and Forms Data without Custom CGI”

Comments are closed.