Adobe acrobat 7.0.5 sdk User Manual

Page of 122
83
Forms and the Acrobat SDK
Acrobat Forms and the Acrobat SDK
9
The Forms API
The Forms plug-in for Acrobat allows plug-in developers to author Acrobat form fields. For 
Adobe Reader, the Forms plug-in does not allow form authoring, but allows users to fill in 
data and print Acrobat forms. In general, the Adobe Reader Forms plug-in also does not 
allow users to save data to the local hard disk. However, if the PDF document has additional 
usage rights, then it may be able to save the document or perform other functions. For 
more information, see 
.
Both Acrobat and Adobe Reader allow Web designers to send data from the form back to a 
Web server.
The Forms API uses the 
PDField
 object, which is an opaque object representing a field in 
an Acrobat form. 
A PDF document that contains an Acrobat form has an AcroForm entry in the document 
catalog dictionary, which contains an array of references to each of the root fields in the 
document. 
The three most important properties of a field are its type, name, and value. Other 
properties specify the appearance of a field. Fields can be organized into a hierarchy, and 
other field properties associate it with its parent and children.
OLE Automation for Acrobat Forms
The Acrobat Forms plug-in has been enhanced to work as an Automation server in the 
Win32 environment. There is no equivalent support in a Mac environment. 
OLE Automation is particularly useful for creating custom forms from an external 
application. Methods and properties are provided that allow you to programmatically 
associate actions and Acrobat JavaScript scripts with form fields. You can also add 
document-level JavaScript scripts.
A very important and useful feature of OLE Automation of Acrobat forms is the 
ExecuteThisJavaScript
 method of the 
AFormApp
 object. The JavaScript string 
passed to this method is immediately executed in the context of the current form. You can 
also use the 
ExecuteThisJavaScript
 method to execute JavaScript scripts from non-
forms PDF documents.
Since the automation capabilities have been added to a plug-in, rather than an executable 
that can be directly launched, there are several steps you must perform to be able to access 
them from an Automation controller. See the Acrobat and PDF Library API Reference for 
complete details.