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

Importing form data from Javascript

BeejCyr
Registered: Aug 26 2008
Posts: 2
Answered

I am trying to create a basic "mail merge" type of document. I am dumping data from a program into a flat file and I want acrobate to import it as form data and print.

I am creating a text (tab delimited) flat file and have no problems importing it into acrobat by clicking Forms->Manage Form Data->Import. However, I want this to all happen without user intervention, so I thought I would just issue acrord32 /t filename to print the file but I need a hook to import the data.

I know I can attach a script to the "Document will print" event and this is where I am hoping to import, but how? Am I going to have to open the file myself, parse and evaluate each field in my script or is there a method I can call to have ready do it?

My Product Information:
Reader 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "doc.importTextData()" is the Acrobat JavaScript equivalent of the "import" menu item. However, there are some restrictions on using it. You can look it up in the Acrobat JavaScript Reference.

I don't think the "WillPrint" event is a good place to use this function since there could be some nasty timing conficts between importing data and printing. In fact, this best place to use this function is from an automation script. Where you could do both, merge the data and print the file.

You might also want to consider using an external application, like a custom VB app to control Acrobat. The custom app would give you more control over the process and allow you to do volume. Look in the Acrobat Interapplication Communication (IAC) reference for more information

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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