Adobe PDF files are optimal for online viewing, particularly when they contain forms. Using Acrobat 5.x or Acrobat 6 Professional, you can create Adobe PDF forms that contain lists and checkboxes, radio buttons, text fields, or buttons. For example, a button could send form data to a script on a Web server. (Some form of script, or application, must be on the Web server to collect and route the data to another location, such as a database.)
Submit PDF forms from within a Web browser (for example, Netscape Navigator or Microsoft Internet Explorer). If you try to submit a PDF form in Adobe Reader, it returns the error "Acrobat Forms: You require a web browser to submit this form."
Creating PDF forms
To create forms, use one of the form tools (for example, the Button tool or the Check Box tool) in Acrobat 6 Professional. Alternatively, use the form tool in Acrobat 5.x. You can create forms in any PDF file as long as the PDF file's security restrictions don't prevent you from modifying it. (You cannot create forms with Adobe Reader, Acrobat Approval, or Acrobat Standard.)
Options for submitting form data
After the information has been added to form fields, you can gather information from the fields and save it in a Forms Data Format (FDF) file. FDF is a text file format specifically for data exported from PDF form fields. FDF files are smaller than PDF files because they contain only form field data, not the entire form. You create FDF files in Acrobat by choosing Advanced > Forms > Export Forms Data (Acrobat 6 Professional) or File > Export > Form Data (Acrobat 5.x). In Adobe Reader 6 and later, you can export form data from a PDF file. Choose Document > Fill-in Form if the creator of the PDF file enabled the Fill-In form feature.
You can also set up a form button to create an FDF file and send it to a Web address (URL). See "Using CGI Scripts to Collect FDF Information" below for more information.
After you create an FDF file, you can let another application parse it and populate a database with the information, or you can electronically send it to another location. If you send it to another location, that data can be imported into the form fields of a PDF file at that location. (The form fields in the PDF file into which the FDF data is being imported must directly correspond to the form fields in the FDF file.) You can use the FDF Toolkit to populate PDF form fields with data from a database. You can also use the FDF Toolkit to extract data from form fields to populate a database. See "Getting Help with Acrobat Forms and Scripts" below for more information.
In addition to FDF, HTML, and text, all of which are options for submitting form data, Acrobat 5 and later also lets you submit an entire PDF file or its form field data in XFDF format. XFDF is an XML-encoded FDF that allows for hierarchical representation of field data, but it doesn't support as many types of data as FDF can. For example, FDF can include incremental changes to the PDF file, digital signatures, and graphical data, but XFDF cannot.
PDF form handling
PDF forms that are viewed online within a Web browser maintain the same functionality as if they were viewed locally, including form submission functionality. To set up forms to work on the Web, evaluate the extent to which Acrobat is required in the process and identify the point from where the Web server takes over. You can create a form field button that will submit the form data (FDF) to a Web address. These steps will be taken in an Acrobat application. The web server handles the remaining part of the form data submission. The URL to which you send the FDF file must be set up with instructions to handle the FDF file. CGI scripts, which are explained below, are the most common type of scripts used to receive FDF files.
Here's an example workflow of how a PDF file can be used to send PDF form information to a script on a Web server:
1. You create an Acrobat PDF form file in Acrobat, and then place the file on a Web server.
2. A user connects to your Web server and loads the PDF file.
3. The user fills out the PDF form fields and clicks the submit button.
4. The Acrobat viewer exports the form field information as an FDF file.
5. The FDF file is then sent to a specified URL. Thereafter, the Acrobat viewer is no longer involved.
6. A CGI script at the specified URL receives the FDF file, reads it, and processes the information in it.
Serving Dynamic PDF files
You can set up Web server scripts to fill in, or populate PDF form fields by serving FDF information to the PDF file. Populating PDF form fields with a response from a database is similar to making a query to a database and receiving an answer. You'll need a script to take the response and route it back to the form fields, which are then populated with the appropriate information from the database. (The form fields in the PDF file the FDF data is being imported into must directly correspond to the form fields in the FDF file.)
For example, after a user makes selections and submits information using a PDF form, you may want the Web server to return a PDF file displaying the options that the user selected.
Dynamically serving PDF files requires scripts and experience with Web servers. In this case, Acrobat Technical Support does not provide any assistance.
Using CGI scripts to collect FDF information
CGI (Common Gateway Interface) is the standard interface scripting language for running a program and returning the result to a Web browser. CGI scripts can read and write files, and access databases or other applications. You use a programming language such as C or Perl to compose CGI scripts in a text-editing application (for example, WordPad). To create a CGI script that will collect FDF information, you need the following:
- A programming language such as C (which requires a compiler) or Perl (which has strong text processing capabilities and flexible syntax).
- Proficiency in the programming language. CGI, like many things on the Internet, periodically changes. Check the latest specifications for CGI.
- An application to receive and process the FDF information.
- A Web server.
Acrobat viewers can route FDF information to a server. If the information is already present in the server, Acrobat viewers can't reroute the information elsewhere. Use a CGI script to route the information (like with an HTML page). The CGI script will parse, or read, the FDF data, then route it according to its instructions.
For a CGI script to parse FDF data, include the CGI script name in the information that you submit the information from the Acrobat PDF form to a web server. The script name must be followed by the pound (#) character and the capital letters "FDF", so the script recognizes the data as FDF. For example, the URL could read "http:/cgi-bin/MyScript.cgi#FDF."
For sample CGI scripts, see the Acrobat FDF Toolkit SDK, which you can download from the AdobePartner Connection Developers Program website.
Getting Help with Acrobat Forms and Scripts
Adobe Acrobat Technical Support provides general Acrobat software support. However, Acrobat Technical Support does not assist with the following:
- JavaScript, CGI, or other scripting and programming languages, though, even when used with an Acrobat-created file (PDF or FDF).
- Dynamic page templates. Dynamic page templates enable developers to create customized forms applications, catalogs, brochures, and other publications that can be personalized and delivered quickly.
The AdobePartner Connection does provide documentation and support for Acrobat forms developers, including a Software Developers Toolkit (SDK) for Acrobat Forms. For information about becoming an Adobe Partner Connection member, visit Adobe's Web site at http://partners.adobe.com/asn/developer/main.html. For forms resources, including the Acrobat SDK and the FDF Toolkit, visit http://partners.adobe.com/asn/acrobat/docs.jsp.
Additional information
: Using the "mailto:" Command to Test a Submit Button in an Acrobat Form