Adobe PDF files are usually optimal for online viewing, particularly when they contain forms. Using Acrobat 5.x or Acrobat 6.0 Professional, you can create Adobe PDF forms that contain list and check boxes, radio buttons, text fields, or buttons that execute specific behavior. 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.)
You must 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, Adobe Reader returns the error "Acrobat Forms: You need to be running inside a web browser in order to submit this form."
To create forms, you use one of the form tools (for example, the Button tool or the Check Box tool) in Acrobat 6.0 Professional, or you 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.)
After 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 significantly 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.0 Professional) or File > Export > Form Data (Acrobat 5.x). In Adobe Reader 6.0 and later, you can export form data from a PDF file by choosing 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 also use the FDF Toolkit to populate PDF form fields with data from a database or 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.0 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 forms that are viewed on-line 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, you need to understand how much involvement the Acrobat applications have in the process and 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 rest of the form data submission is handled by the Web server: The URL that you send the FDF file to must be set up, usually with a script, to know what to do with 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. After this, 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.
As with HTML forms, 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 will 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 instance, 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, and it isn't supported by Acrobat Technical Support.
CGI (Common Gateway Interface) is the standard interface scripting language for executing a program and returning its result to a Web browser. CGI scripts can read and write files, as well as access databases or other applications. You use a programming language such as C or Perl to compose CGI scripts in a text-editing application (i.e., 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, but they can't do anything with it once it's there, so you must use a CGI script to route the information (just as 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 on a Web server to parse FDF data, you must submit the information from the Acrobat PDF form to a URL that includes the CGI script name. 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 Web site at http://partners.adobe.com/asn/acrobat/index.jsp.
Getting Help with Acrobat Forms and Scripts
Adobe Acrobat Technical Support provides assistance with Acrobat software. Acrobat Technical Support does not assist with the following:
- Dynamic page templates. Dynamic page templates enable developers to create customized forms applications, catalogs, brochures, and other publications that can be personalized and delivered on-the-fly.
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.