Skip to content

Add or Edit Custom Calculation JavaScript

Any form you create that requires calculations is likely to require custom calculation scripts. You can use preset calculation formulas for simple addition and multiplication. For other calculations, write a custom calculation script. 

To write a calculation script

  1. Open the PDF in Nitro PDF Pro

  2. On the Forms ribbon, in the Form Fields group, click Text Field

    Forms Field

  3. Select the text field to edit
  4. Right-click and select Properties
  5. Click the Calculate tab
  6. Click the Custom calculation script option, and then click the Edit button
  7. Type the code for your script. In the example below, a simple routine is created to calculate sales tax at a 7.25 % rate. The code used is:
    var f = this.getField(subtotal);
    event.value = Math.round(f.value * 7.25)/100;
  8. Click OK





Last updated: July 30, 2026