Adobe Javascript

Pasting paste

Pasting paste

I occasionally create PDF forms for work that would be a lot more useful with just a little bit of logic.  Luckily, PDF’s can run javascript.  To save me from having to continually search for this same information every few months, I’m copying and pasting a piece of an Adobe forum thread here:

// Obtain the value from the first field

var v1 = getField(“balance1”).value;

// Obtain the value from the second field

var v2 = getField(“amount2”).value;

// Set this field value equal to the sum

event.value = v1 + v2;

That should do it.

Photo courtesy of pvera.