FDF methods

addContact

close

signatureClear

addEmbeddedFile

mail

signatureSign

addRequest

save

signatureValidate

addContact

6.0

D 

S 

X 

Adds a contact to the FDF file.

Parameters

oUserEntity 

An UserEntity object that list the contact to be added to the FDF file.

Returns

Throws an exception on failure.

Example

   var oEntity={firstName:"Fred", lastName:"Smith", fullName:"Fred Smith"};

   var f = app.newFDF();

   f.addContact( oEntity );

   f.save( "/c/temp/FredCert.fdf" );

addEmbeddedFile

6.0

 

S 

X 

Add the specified file to the end of the array of embedded files in the FDF file. Anyone opening the FDF file will be instructed to save the embedded file or files according to nSaveOption. If the embedded file is a PDF file, it is opened and displayed. If the embedded file is an FDF file, the file is opened for processing.

FDF files containing embedded files have been supported beginning with Acrobat 4.05. An example use for embedding PDF files is when these files are hosted on an HTTP server and the user should click to download and save the PDF file, rather than viewing the file in the browser. There is no relationship between these embedded files and files that are associated with forms data that is stored in an FDF file.

Parameters

cDIPath 

(optional) A device-independent absolute path to a file on the user’s hard drive. If not specified, the user is prompted to locate a file.

nSaveOption 

(optional) Specifies how the embedded file will be presented to the user opening this FDF file, where the file will be saved, and whether the file will be deleted after it is saved. Values are:

0 — The file will be saved to the Acrobat document folder. In Acrobat 8, the user will see a confirmation dialog which must be agreed to before the file will be saved to the disk

1 — (the default) The user will be prompted for a file name to which to save the embedded file.

2 — Should not be used.

3 — The file will be automatically saved as a temporary file and deleted during cleanup (when Acrobat is closed).

In Acrobat 4.05 through 5.05, for values of 0 and 3, the user is prompted for the location of the save folder if they have not already set this value.

For all values of nSaveOption, if the file is a PDF or FDF file, it is automatically opened by Acrobat after it is saved.

Returns

Throws an exception if this operation could not be completed, otherwise returns the number of embedded files that are now in the FDF file.

Example

Create a new FDF, embed a PDF doc, then save.

   var fdf = app.newFDF();

   fdf.addEmbeddedFile("/C/myPDFs/myDoc.pdf");

   fdf.save("/c/temp/myDocs.fdf");

addRequest

6.0

 

S 

X 

Adds a request to the FDF file. There can be only one request in an FDF file. If the FDF file already contains a request, it is replaced with this new request.

Parameters

cType 

What is being requested. Currently the only valid value is the string “CMS”, which is a request for contact information.

cReturnAddress 

The return address string for the request. This must begin with
mailto:, http: or https: and be of the form "http://www.example.com/cgi.pl" or "mailto:jdoe@example.com".

cName 

(optional) The name of the person or organization that has generated the request.

Returns

Throws an exception if there is an error.

Example

   var f = app.newFDF();

   f.addRequest( "CMS", "http://www.example.com/cgi.pl", "Acme Corp" );

   f.save( "/c/tmp/request.fdf" );

close

6.0

 

S 

X 

Immediately closes the FDF file.

Returns

Throws an exception if there is an error.

See the FDF object save method, which also closes an FDF file.

Example

See example following the addEmbeddedFile method.

mail

6.0

 

S 

X 

Saves the FDF object as a temporary FDF file and mails this file as an attachment to all recipients, with or without user interaction. The temporary file is deleted after it is no longer needed.

See also app.mailGetAddrs, app.mailMsg, the Doc methods mailDoc and mailForm, and the Report object method mail.

Note:On Windows, the client computer must have its default mail program configured to be MAPI enabled to use this method.

Parameters

bUI 

(optional) Specifies whether to display a user interface. If true (the default), the rest of the parameters are used to seed a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.

Note:(Acrobat 7.0) When this method is executed in a non-privileged context, the bUI parameter is not honored and defaults to true. See Privileged versus non-privileged context.

cTo 

(optional) A semicolon-separated list of recipients for the message.

cCc 

(optional) A semicolon-separated list of CC recipients for the message.

cBcc 

(optional) A semicolon-separated list of BCC recipients for the message.

cSubject 

(optional) The subject of the message. The length limit is 64 KB.

cMsg 

(optional) The content of the message. The length limit is 64 KB.

Returns

Throws an exception if there is an error.

Example

   var fdf = app.openFDF( "/c/temp/myDoc.fdf" );

   /* This opens the compose new message window */

   fdf.mail();

   

   /* This will send out the mail with the attached FDF file to fun1@example.com
   and fun2@example.com */

   fdf.mail( false, "fun1@example.com", "fun2@example.com", "",

      "This is the subject", "This is the body.");

save

6.0

 

S 

X 

Save the FDF object as a file. A save will always occur. The file is closed when it is saved and the FDF object no longer contains a valid object reference.

See the close method, which also closes a FDF file.

Parameters

cDIPath 

The device-independent path of the file to be saved.

Note:cDIPath must be a safe path (see Safe path) and must have an extension of .fdf.

Returns

Throws an exception if there is an error.

Example

Create a new FDF, embed a PDF doc, then save.

   var fdf = app.newFDF()

   fdf.addEmbeddedFile("/C/myPDFs/myDoc.pdf");

   fdf.save("/c/temp/myDocs.fdf");

signatureClear

6.0

 

S 

X 

If the FDF object is signed, clears the signature and returns true if successful. Does nothing if the FDF object is not signed. Does not save the file.

Returns

true on success.

signatureSign

6.0

 

S 

X 

Sign the FDF object with the specified security object. FDF objects can be signed only once. The FDF object is signed in memory and is not automatically saved as a file to disk. Call save to save the FDF object after it is signed. Call signatureClear to clear FDF signatures.

Parameters

oSig 

The SecurityHandler object that is to be used to sign. Security objects normally require initialization before they can be used for signing. Check the documentation for your security handler to see if it is able to sign FDF files. The signFDF property of the SecurityHandler object will indicate whether a particular security object is capable of signing FDF files.

oInfo 

(optional) A SignatureInfo object containing the writable properties of the signature.

nUI 

(optional) The type of dialog box to show when signing. Values are:

0 — Show no dialog box.

1 — Show a simplified dialog box with no editable fields (fields can be provided in oInfo).

2 — Show a more elaborate dialog box that includes editable fields for reason, location, and contact information.

The default is 0.

cUISignTitle 

(optional) The title to use for the sign dialog box. It is used only if nUI is non-zero.

cUISelectMsg 

(optional) A message to display when a user must select a resource for signing, such as selecting a credential. It is used only when nUI is non-zero.

Returns

true if the signature was applied successfully, false otherwise.

Example

Open an existing FDF data file and sign.

   var eng = security.getHandler( "Adobe.PPKLite" );

   eng.login("myPassword" ,"/c/test/Acme.pfx");

   var myFDF = app.openFDF( "/c/temp/myData.fdf" );

   if( !myFDF.isSigned ) {

      myFDF.signatureSign({

         oSig: eng,

         nUI: 1,

         cUISignTitle: "Sign Embedded File FDF",

         cUISelectMsg: "Please select a Digital ID to use to "

            + "sign your embedded file FDF."

      });

      myFDF.save( "/c/temp/myData.fdf" );

   };

signatureValidate

6.0

 

 

X 

Validate the signature of an FDF object and return a SignatureInfo object specifying the properties of the signature.

Parameters

oSig 

(optional) The security handler to be used to validate the signature. Can be either a SecurityHandler object or a generic object with the following properties:

oSecHdlr — The SecurityHandler object to use to validate this signature.

bAltSecHdlr — A Boolean value . If true, an alternate security handler, selected based on user preference settings, may be used to validate the signature. The default is false, meaning that the security handler returned by the signature’s handlerName property is used to validate the signature. This parameter is not used if oSecHdlr is provided.

If oSig is not supplied, the security handler returned by the signature’s handlerName property is used to validate the signature.

bUI

(optional) If true, allow the UI to be shown, if necessary, when validating the data file. The UI may be used to select a validation handler, if none is specified.

Returns

A SignatureInfo object. The signature status is described in status property.

Example

Open an FDF file, if signed, validate it the signature and return information to the console.

   fdf = app.openFDF("/c/temp/myDoc.fdf");

   eng = security.getHandler( "Adobe.PPKLite" );

   if (fdf.isSigned)

   {

      var oSigInfo = fdf.signatureValidate({

         oSig: eng,

         bUI: true

      });

      console.println("Signature Status: " + oSigInfo.status);

      console.println("Description: " + oSigInfo.statusText);

   } else {

      console.println("FDF not signed");

   }