How to Calculate Quantity, Price, Discount, and Total in Acrobat Forms
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.

- 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.
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.
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.
Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to make your fields interactive.
Right-click or double-click the 'Total' text field where you want the final result to appear, and select 'Properties'.
In the Properties dialog, click on the 'Calculate' tab. Choose the option labeled 'Custom calculation script' and click the 'Edit' button.
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);
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.

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. Open Your Form: Launch WPS Office and open your fillable PDF document using the WPS PDF editor.
- 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. 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. Save and Share: Once completed, click 'Save' or export your filled PDF directly to share with clients or colleagues securely.

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);




