Posts Tagged Acrobat

Javascript for Acrobat

February 1 2008

From my online wanderings yesterday, this trove of Javascript tips; Acrobat User Community: JavaScript Corner focusing specifically on Javascript in PDFs.

Tags: , ,

Comments (+)

Calculated Field in Adobe Acrobat Form

January 30 2008

This is a note to myself about the javascript syntax needed to calculate a textbox field on an order form I created. For this example, the price per item is based on the quantity entered via textbox (“text_1”), calculated according to a fixed table that I’ve hard coded. Setting the Event.value property displays the result in the specified textbox.

var qty = this.getField("text_1").value;
var price = 0;
if (qty > 750) {
     price = 275;
 } else if (qty >375) {
     price = 300;
 } else if (qty >175) {
     price = 325;
 } else if (qty >75) {
     price = 350;
 } else if (qty >25) {
     price = 375;
 } else if (qty >1) {
     price = 400;
 } else {
     price = 500;
 }
Event.value = (qty*price);

This code should be added in the Acrobat form text field properties under the “Calculate” tab. Select “Custom Calculation Script”, press the “Edit” button, and add the javascript.

Reference:

Tags: , , , ,

Comments (+)