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

Importing data from a csv/txt/excel file

wvanhona
Registered: Apr 3 2009
Posts: 3
Answered

Hello,

I was able to create the text file which was needed to fill in a PDF form using the Acrobat PRO/File/Form Data/Export Data to Form.
If use the same template to import into the same PDF it all works fine.

Now I want to use the same txt template to import multiple lines into the same PDF and create a new PDF document for each line with the data filled in.
The PDF should be then stored in a folder on my machine.

As I am not really a developer, has anyone of you the example of the javascript which does all this? or is there easier way to batch this using acrobat pro?

I've seen some posts on importing data from database, but I dont have that, I only have txt file (or csv or excel).

I have acrobat pro 7.0.0.

Thanks for your help,
wendy

My Product Information:
Acrobat Pro 7.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "doc.importTextData()" function imports data from a single row in a "Tab Delimited File". This is a file type that can be exported from Excel. This function can be used from an Acrobat Automation Script to fill in and save a PDF form to create multiple files that are stored on your system. The basic script for doing this is simple, but it has problems. It may or may not work very well. You'll need a developer to work out the kinks if it doesn't work for you
This code operates on the currently open file
var strDataPath = "/c/temp/datafile.txt";var strSaveFilePath = "/c/temp/MysaveFile";var i=0;do{var nRtn = this.importTextData(strDataPath,i);if(nRtn == 0)this.saveAs(strSaveFilePath + i + ".pdf");i++;}while(nRtn == 0);

Run this code from the JavaScript Console window
http://www.acrobatusers.com/tutorials/2006/javascript_console

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/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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