PDF Editing Issues

How to Calculate Quantity, Price, Discount, and Total in Acrobat Forms

Ayan MasoodAyan Masood Oct 28, 2026 869 views

Question details

The user wants to set up a fillable PDF form that automatically calculates the total by multiplying the quantity by the unit price and subtracting the applicable discount.

How to Calculate Quantity, Price, Discount, and Total in Acrobat Forms
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or modifying a fillable PDF invoice or order form that requires dynamic mathematical calculations across multiple fields.
Observed behavior
Requires a custom calculation script to perform the specific equation: (Quantity × Unit Price) − (Discount × Unit Price) accurately within the form.
Before you start

Ensure your PDF form contains dedicated, properly named text fields for Quantity, Unit Price, Discount, and Total, and that you have access to the Prepare Form tool in Adobe Acrobat.

Solution 1Recommended

Use Custom Calculation Scripts in Adobe Acrobat

Implement a JavaScript custom calculation script to handle equations combining multiplication and subtraction, which basic Acrobat settings cannot perform natively.

While Adobe Acrobat offers basic predefined calculations (like simple sums or products), combining multiple operations—such as calculating a subtotal and applying a discount—requires a custom script. By using Acrobat's built-in JavaScript engine, you can define exactly how the final total is computed based on the other fields.

1
Open Prepare Form Mode

Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to make your fields interactive.

2
Access the Total Field Properties

Right-click or double-click the 'Total' text field where you want the final result to appear, and select 'Properties'.

3
Select Custom Calculation

In the Properties dialog, click on the 'Calculate' tab. Choose the option labeled 'Custom calculation script' and click the 'Edit' button.

4
Enter the JavaScript Formula

In the JavaScript Editor, enter the following formula, ensuring the field names in quotes exactly match those in your document: event.value = (this.getField("Quantity").value * this.getField("UnitPrice").value) - (this.getField("Discount").value * this.getField("UnitPrice").value);

5
Save and Test

Click 'OK' to save the script, then close the Properties dialog. Enter sample values into the Quantity, Unit Price, and Discount fields to verify the Total calculates correctly.

Use Custom Calculation Scripts in Adobe Acrobat
Field Name Sensitivity: JavaScript is case-sensitive. Ensure the field names referenced in your script match the exact capitalization and spacing of the actual text fields in your PDF form.
Powerful PDF Editing Alternative

Easily Fill and Manage PDF Forms with WPS Office

While setting up complex JavaScript requires heavy tools, WPS PDF provides a lightweight, highly intuitive alternative for effortlessly filling, viewing, and managing interactive PDF forms across all your devices.

  1. 1. Open Your Form: Launch WPS Office and open your fillable PDF document using the WPS PDF editor.
  2. 2. Fill in the Fields: Simply click on any interactive form field (such as Quantity, Price, or Name) and type in your data directly.
  3. 3. Edit Existing Text: Navigate to the 'Edit' tab if you need to modify the static text or adjust the layout of the invoice or form.
  4. 4. Save and Share: Once completed, click 'Save' or export your filled PDF directly to share with clients or colleagues securely.
Seamlessly fill out and sign interactive PDF forms without complex setups.High compatibility with standard PDF formats exported from Adobe Acrobat.Built-in tools to convert PDFs to editable Excel or Word documents.Fast, lightweight application that doesn't slow down your system.
QA img-9

Frequently Asked Questions

Why is my Total field not updating when I change the Quantity?

This is usually caused by an incorrect calculation order. In Acrobat, go to the 'Prepare Form' tools, look for the 'More' options (or the sidebar menu), and select 'Set Field Calculation Order'. Ensure that fields like Quantity and Price are processed before the Total field.

Can I calculate form totals without using JavaScript in Acrobat?

Yes, but only for simple, single-operation math. If you only need to multiply Quantity by Unit Price, you can use the 'Value is the product (+) of the following fields' option in the Calculate tab. However, combining multiplication with subtraction (for discounts) requires JavaScript.

What if my discount is a percentage rather than a fixed amount?

If your discount is a percentage, you must adjust your custom calculation script. For a percentage discount field (e.g., entering 0.10 for 10%), the script would look like: event.value = (this.getField("Quantity").value * this.getField("UnitPrice").value) * (1 - this.getField("Discount").value);