com.justformspdf.pdf
Class Form

java.lang.Object
  |
  +--com.justformspdf.pdf.Form

public class Form
extends java.lang.Object

The Form class represents the interactive Form of a PDF document. A PDF Form can be filled out by users and submitted just like an HTML form. However, unlike HTML Form, a PDF document has one and only only Form.

There are various type of fields in a PDF Form. Each field type serves a different function, depending on the function or information that will be entered into the field. JustFormsPDF library supports Button, Check Box, Combo Box, Radio Button and Text fields.

Using any PDF Writer (like Adobe Acrobat), user can design and create an entirely new form, or can quickly convert your existing paper and electronic forms to PDF and then add PDF form fields.

Here is an example showing how PDF Form should be accessed and how one of its elements should be filled.

 
 FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf");                          
 PDF pdf = new PDF(new PDFReader(fis));
 Form form = pdf.getForm();             
 FormText text = (FormText) form.getElement("Name");
 text.setValue("John K. Baker");
 
 


Constructor Summary
Form()
           
 
Method Summary
 java.util.Vector getAllFormElements()
          Get list of all form elements in the Form object.
 com.justformspdf.pdf.FormElement getElement(java.lang.String name)
          Return the specified form element.
 java.lang.String toString()
          To get information about all the form elements in PDF Form object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form()
Method Detail

getElement

public com.justformspdf.pdf.FormElement getElement(java.lang.String name)
                                            throws java.lang.Exception
Return the specified form element.

Example usage:

 
 FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf");                          
 PDF pdf = new PDF(new PDFReader(fis));
 Form form = pdf.getForm();             
 FormText text = (FormText) form.getElement("Name");
         
 

Returns:
the specified form element object. The caller has to type-cast the return elementto FormText, FormCheckbox, FormComboBox or FormRadioGroup
Throws:
java.lang.Exception

getAllFormElements

public java.util.Vector getAllFormElements()
Get list of all form elements in the Form object.

Example usage:

 
 FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf");                          
 PDF pdf = new PDF(new PDFReader(fis));
 Form form = pdf.getForm();             
         
 

Returns:
list of form element objects in a Vector form
See Also:
toString()

toString

public java.lang.String toString()
To get information about all the form elements in PDF Form object.

The output is in the form of formatted (tab delimited) text and consists of the following information about each form element in the Form object: