These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Read FDF form data into Batch Process

landrew
Registered: Feb 15 2008
Posts: 12

Hello,

I have a Batch Process that displays a "Select Files to Process" window where the user selects the PDF files to be used in the batch process. The batch will open all PDF files selected, select certain data fields, and add the vales of the fields to global variables. When complete the form that called the batch has a JavaScript routine that will read in the values stored in memory and show them (the totals) on the form.

I would like to include FDF files in the process. When FDF files are selected, the error "Cannot open document" error is displayed in the batch processing window.

I am thinking of doing the following:
1. Open the data form in the Batch script.
2. Read the directory items (file names) into an array.
3. Create a for-loop to Import each FDF.
a. Reset the form.
b. ImportAsFDF();
c. Parse all the fields for their values, adding the totals to the gloval variables
4. Close the form.
5. Open the totals form.
6. Display the global values in form fields.

Does anyone know of a way to streamline this process? In essense I would like to know if there is a way to open a FDF file in a Batch process just like PDF files are selected? Is there a Preferences setting, etc. that will allow the Batch Process to read FDF files?

Thanks in advance.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can't open an FDF directly with a Batch Sequence, and there is no way to get a directory listing using Acrobat JavaScript or a Batch Sequence.

You're methodology is good execpt for this small point. I would suggest writing your main application in VB (or AppleScript if you're on a MAC) using the IAC (interapplication communication) API. Use a Folder Level JavaScript to define your main functions as trusted, i.e. the function for importing the FDF and reading and writing the global vars. Then use the VB script to do all the directory searching, opening files, and calling the Folder Level JavaScript functions. Basically, this is recreating the Batch Processing functionality in an external VB application that drives Acrobat.

You'll find the documentation for IAC here:
http://www.adobe.com/devnet/acrobat/

Look in the right hand column for the link.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script