I have a database with all the staff's information for our fax system in our department. The pdf plugin will do a certain thing that's necessary to send and receive fax as they come attached to our email in pdf format. Currently, all the staff's information is hard coded to the program so that the fax has annotation with the user's name and id number. Instead of hard coding I want to pull the necessary information from the database and annotate the fax (pdf document). The JavaScript is just a trial but it's not doing what it's supposed to. Here's the script -
//=========================================================================
try
{
var Connect = ADBC.newConnection("database","user","password");
if(Connect == null) {app.alert("Could not connect");}
else{app.alert("Database connected..");}
var statement = Connect.newStatement();
if(statement == null) throw "Could not execute newStatement";
var execStr = "Select first, second, third, fourth, fifth, sixth from table" ;
if(statement.execute(execStr)) throw "Could not execute the requested SQL";
statement.nextRow();
var row = statement.getRow();
console.println(row.first.value);
}
catch(e) {
app.alert("Error!" + e);
}
//======================================================================
It connects and doesn't throw me any error but it prints some different characters in the console window. The character looks likes this 獳慭汬. And it's different for different rows. I'm currently using Acrobat 9 Pro and I have already modified Registry to "activate" ADBC connection.
Thank you for your help.
Sirish
The problem is probably with the data being returned, looks like it's binary. Could be a problem with how data is translated. Check the formatting in the DB. Is it Unicode?
I would suggest that you run your code line by line from the Console window. Look at the column info object to see what the data types are and check the all the column names and values returned to make sure what you want is what you are getting.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script