Huge performance issue when calculating fields in Acrobat
Hi,
With this post I would like to ask a question.
I have a 50 page PDF document and each page contains 4 columns of 15 fields. The total of each column of fields should be summarized. when using a script in Acrobat to calculate the fields based on the field names. The script works fine, but when entering values into the fields, using the tab key, it takes 3-4 seconds to navigate between the text fields.
I'm using this script...
event.value = myCalculation(this, "01-A-1");
function myCalculation(myDoc, myText){
var myResult = 0;
for (var i=0; i<myDoc.numFields; i++) {
var f = myDoc.getField(myDoc.getNthFieldName(i));
if (f.name.indexOf(myText) == 0){
myResult = myResult + Number(f.value);
}
}
return myResult;
}
The script checks every element in the document after a field is changed and that's probably the reason the script is slow. Does the Acrobat DOM contains a page object containing only the fields of a certain page ? By checking only the elements of a specific page in stead of the entire document, will boost the performance.
Using the default sum function (without) scripting doesn't affect the performance and works very fast.
Does anyone have any suggestions how this can be solved using scripting ?
Thanks
