Learning Centers

Developing with PDF Forms

July 01, 2004

Advertisement
Advertisement
 

Editor's Note: This article is part of the Introduction to Acrobat Development Learning Center

What are PDF Forms?

A PDF Form is a standard PDF document that contains Form Fields. These form fields are placed onto the PDF document using Acrobat 5, Acrobat 6 Professional or Adobe Designer and saved as a normal PDF document.

Just like their HTML counterpart PDF Forms allow the author to capture information from users by way of submitting the entered forms data.

Currently the following PDF Forms fields are available:

  • Buttons
  • Text Fields
  • Combo Boxes
  • List Boxes
  • Radio Buttons
  • Check Boxes
  • Digital Signatures

There are several major differences between HTML forms and PDF Forms:

  1. HTML forms require a web browser, PDF forms require Acrobat or Adobe Reader to be filled out.
  2. PDF Forms require Adobe Acrobat or Adobe Designer for their creation, anyone with Notepad and a web browser can create/view HTML forms.
  3. Entered data in a HTML form is generally not saved for later use, the data is submitted to an online process. PDF Forms can save their data to various formats locally1 for later processing online or viewing in Acrobat/Reader.
  4. To prefill a HTML form requires the construction of the entire HTML document, to prefill a PDF Form an FDF file can be constructed and later used to open the PDF with its form field data prefilled.
  5. In a HTML form the data and structure are the same, PDF Forms have a separation between the form fields structure and its data.
  6. Construction of a HTML form is far simpler than a PDF form due to the underlying structures of HTML and PDF.

What is FDF?

The Forms Data Format is a standard way to represent form field data. FDF files are based on PDF and have the same syntax and basic object types as PDF except an FDF doesn't need to have a Cross Reference Table.

The Forms Data Format is defined and described within the Portable Document Format specification (link), under the section for Interactive Features>Interactive Forms. It's here that you can become intimate with the inner workings, tags, objects and technical information needed to build, parse and understand FDF.

Below is an example FDF file, it describes the form fields, their properties and of course the form field data.

%FDF-1.2
%âãÏÓ
1 0 obj
<>
  ]
 >>
>> endobj trailer
<>
%%EOF

FDF files are not complex to create; they are text and follow a very logical structure. However when you need to programmatically creates a lot of FDF files it's useful to have a library to perform these tasks; enter the Forms Data Format Toolkit.

FDF Toolkit

As mentioned the FDF Toolkit isn't something you must have to develop or parse FDF files, it does however make life a lot simpler by automating the mundane tasks of reading and writing FDF content.

There are three flavors; Unix, Java and Windows and two versions of the FDF Toolkit available from Adobe; Version 5 and Version 6.

The Unix version of the FDF Toolkit provides wrappers for C and Perl, Windows has ActiveX, Perl and C support and the Java FDF library provides classes for Servlets, JSP and J2SE/Desktop applications.

Why Use PDF Forms

There are two main reasons to use PDF Forms. The first is the Forms Data Format (FDF) and the second reason is the ability to submit entered data in one of 5 different formats.

By providing a way to abstract the entered data from the form design it allows designers and developers the opportunity to separate two disparate functions: Design and Content.

For example an online travel shop could provide dynamic quotes from a database as an FDF file and subsequently have this loaded into a standard PDF quoting template. No special user software is required - only (at a minimum) Reader.

Entered form field data can be sent to a backend process in one of the following five formats:

  1. URL Encoded Format. This is the most common format for browsers. [application/x-www-form-urlencoded]
  2. Multipart/form-data. If you have ever uploaded a file to a web server this is the format it is sent as. [multipart/form-data]
  3. Forms Data Format (FDF). Essentially in the same format as you would build an FDF, this format is specific to Acrobat. [application/vnd.fdf]
  4. XFDF format. This is an XML-encoded version of FDF. Form Data is sent represented hierarchically. [application/vnd.adobe.xfdf]
  5. PDF format. Send the whole document in its entirety. [application/pdf]

This provides the developer with the greatest possible chance for easy integration into existing backend processes.

Form Fields inside a PDF document can be programmatically controlled with a much greater degree of validation and formatting available than with browser Javascript.

For example it's possible to place into a Form Field a validation script, calculation script and keystroke script effectively trapping the users wrong input, adding automatically and ensuring only the correct characters are entered.

How to Develop PDF Forms

There are currently three key Adobe tools that provide Forms authoring capabilities. Acrobat v6 Professional, Acrobat v5 and Designer. Despite its name the FDF Toolkit cannot generate form fields, it can purely describe the field name that the Data belongs to.

Adobe's latest Form tool, Designer is able to generate (automatically) PDF Forms based on Database Schema, XML Schema's and even other PDF Forms. It can have very tight integration with XML data structures providing a seamless end-to-end process for designing, validating and storing user entered data. Along with these new development abilities it's now possible to integrate PDF Forms into your pre-existing Web Services.

Where Are They Used?

The largest producer/consumer of PDF Forms that I have found is the United States Internal Revenue Service (IRS), as a rough count they have over 800 PDF forms in use today (http://www.irs.gov).

Summary

In this article we looked at what a PDF form is, roughly what they look like and also how they can be generated. The next step is to look at specific examples of how they can be used in a real way.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Two Passwords Are Better Than One: The Low-Down On PDF Security

For people who don't spend their time looking at PDF files in text editors*, PDF security is a sometimes misunderstood beast.

For example, those document restrictions that PDF files sometimes have -- no Printing, Content Copying, Page Extraction, etc -- are essentially useless unless the PDF also has a User Password.

January 09, 2014
Platinum Sponsor



Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist 11

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

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.