Have you taken advantage of Acrobat's forms? Many users extend the functionality of their online forms with PDF form fields, enabling a user to fill out the form online or offline. If a user chooses to complete the form online by entering data in each form field, the user can then print out and fax or mail in the form, or the user may expect to be able to submit the form data electronically over the web. This fortnight, I'll focus in on some easy ways to get data from your online Acrobat forms into a web-served database, resent as email and other common applications.
There are lots of information and some great examples of how you can add form fields to your PDF files. If you're unfamiliar with constructing a PDF form, see Adobe's example at http://www.adobe.com. Also, you'll find a list of some good examples sites and other online form resources at the end of this article.
What do you want to do with the data a user enters into a form?
Once you?ve built your PDF form, you'll want your users to submit the data they enter into the form over
the Internet for online storage or further processing. The task of submitting data from a PDF form to a
webserver's CGI script, database or other web-based application is easier than you might think.
First some basics:
The form data submitted from a PDF form file can be sent as the Form Data Format (or FDF) or as
url-encoded form data (called application/x-www-form-urlencoded data). You choose to send the data as
either FDF or url-encoded data in the "SubmitForm Selections" dialog box. This box appears when
you select the "Submit Form" action, and click the "Select URL" button on in the
"Edit an Action" dialog box. In these examples we'll use HTML form data.
When a user submits data from a PDF file to a webserver, the user must be viewing the PDF file
within a web browser. If a user downloads the PDF file and completes the form in Acrobat Reader, when the
user attempts to submit the form, they'll get an error that the file must be viewed within a web browser in
order to submit the data.
When the data is submitted from a PDF file the results of the processed data is often a response of
some sort. The response could be the results of a search, a confirmation of an order, etc. The response for
PDF files can have one of two results:
The response can be a PDF file, either a subsequent page of the same PDF file, or the population of
various form fields within the same page or file. When the data submitted results in a PDF file, you generally
submit the data to your web server as an FDF file. This article will focus on the other kind of response, listed
The response to submitted data can be stored in a database, rendered as an HTML or other file
type. Additionally you can have the data processed and emailed to a user. So how do you process this data?
That's covered next.
Reuse rather than rebuild
If you want to have your data processed and the response to be an HTML or other file format, or sent to
a user in an email, there's short work to be done. The url-encoded data that is sent from a PDF form can be
processed just like data sent from an HTML form. So, you can use the thousands of freeware scripts in Perl,
C+, Visual Basic, or development environments and tools like Microsoft's Active Server Pages (ASP), Allaire's
If you're not familiar with any of the technology that is used to process form data, don?t worry, you can
use the hundreds of freeware scripts available online (see below). You can also make use of the scripts your
Internet service provider (ISP) or company has already written.
What do you want to do with the data from your forms?
There are a variety of data processing options for the data submitted from your PDF form.
Here's a few of the most common form uses:
Submit the data from the form fields into a database.
Submit the data to a search engine and return the results of the search query to the user.
Process the data in some way and send the result of the processing back to a user on a web page
Process the submitted data and send the results of the processing to the user via email.
Looking for some scripts you can use for free? Visit http://cgi.resourceindex.com /Programs_and_Scripts/ click on the Perl scripts section (or
other languages if you prefer ), then click on the "Forms Processing" link. Here you'll find script
that do the common tasks above plus lots of other applications.
What to remember when you build a PDF form
Most scripts that process url-encoded data, including the scripts listed above, identify the data entered
into each field by name-value pairs. For example, a form that requests your username and password has two
sets of name value pairs. The username field (named "username" in this example) has a value.
The value is the text the user enters. The second name-value pair is the password field (named
"password" in this example). When the script processes the form data it processes the values
entered by the user of the data named "username" and "password". Other data from other fields is ignored in this example.
So, when you build your PDF form, if the script that will process the data is looking for specific name value pairs, be sure the name of your PDF form fields are correct. If the script requires data from a field named "username" and a field named "password" the names of your PDF file's form fields must be the same. Generally, these scripts are case-sensitive; so be sure your field names are
Note that many scripts use hidden form fields. You can replicate this functionality in your PDF forms, too.
To create a hidden PDF form field, set the form field to "hidden" in the "Common
Properties" section of the "Field Properties" dialog box (in the "Appearance"
Finally, set the button or other "trigger" that will submit the data to the webserver. You can
use a submit button, like an HTML form, or you can set the trigger to be the opening or closing of a page or
file, when a user moves their cursor over a form field (or exists the field), and much more. To submit the form
data, choose the "Submit Form" action regardless of the "trigger" that you choose.
To set the "Submit Form" action, select a trigger and choose the "Submit Form"
action from the list of possible actions. In the Action dialog box, click on the "Select URL" button.
In this dialog box, type in the URL of the script that will process the data. The URL entered is the same as
the form's "Action" value. Select HTML Form (URL encoded) in the "Export Format"
section. You can also select the fields you want to submit given the action.
Try out the script
Save your PDF file and you're ready to give the form and the script a try! Generally, if a script works
with an HTML form, the script will also work with a PDF form.
OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.