How to Apply Different Tax Rates in an Acrobat PDF Form
Question details
The user needs to calculate a final amount in a PDF form by conditionally applying different tax rates based on a selected location (New Orleans vs. Baton Rouge) and then subtracting a gift card value.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that automatically calculates final totals based on conditional tax rates and discounts.
- Observed behavior
- Requires a method to implement conditional calculation logic for variable tax rates and gift card deductions within a PDF form's total field.
Ensure you have access to the PDF form in editing mode and possess basic familiarity with JavaScript, as conditional calculations in PDF forms require custom scripts.
Add a Custom Calculation Script to the Total Field
Use JavaScript to conditionally apply the correct tax rate based on the chosen location and subtract the gift card amount from the final total.
Built-in PDF calculation tools only cover basic arithmetic like simple sums and products. To apply conditional logic (e.g., choosing a tax rate based on a selected city), you must use a custom calculation script.
Open your document in Adobe Acrobat and select 'Prepare Form' from the Tools menu.
Right-click the 'Total' text field where the final amount will be displayed and choose 'Properties'.
Navigate to the 'Calculate' tab in the Properties window and select the 'Custom calculation script' radio button.
Click the 'Edit' button. Write a JavaScript snippet that retrieves the selected location, multiplies your subtotal by the corresponding tax rate (e.g., New Orleans rate or Baton Rouge rate), subtracts the value of the 'Gift Card' field, and assigns the final number to `event.value`.
Click 'OK' to close the JavaScript editor, then close the Properties window. Enter test values into your form fields to ensure the conditional tax rate and gift card subtraction work perfectly.

Set Location Fields to be Mutually Exclusive
Prevent calculation conflicts by ensuring users can only select one tax location at a time.
Edit and Manage Interactive PDF Forms with WPS PDF
WPS Office provides a comprehensive PDF toolkit that allows you to easily view, fill, and manage interactive PDF forms equipped with complex calculations.
- 1. Install WPS Office: Download and install the free version of WPS Office on your device.
- 2. Open your PDF form: Launch WPS PDF and open the interactive form that contains the conditional tax rate calculations.
- 3. Fill out the fields: Click into the form fields. As you enter the subtotal, select the location, and input the gift card amount, the embedded scripts will run.
- 4. Review the calculations: Verify that the Total field automatically updates based on the embedded logic.
- 5. Save your completed form: Click 'Save' or export your filled PDF form to share it with others.

Frequently Asked Questions
Can I apply conditional tax rates without using JavaScript in Acrobat?
No. The built-in calculation options in Adobe Acrobat only cover basic math operations like sum, product, and average. Conditional logic, such as checking a location to determine a tax rate, strictly requires custom JavaScript.
Why isn't my Total field updating when I change the location?
This is typically caused by an incorrect calculation order or a syntax error in your JavaScript. Check your script for typos, and go to the 'More' menu in Prepare Form mode to adjust the Field Calculation Order so the Total calculates last.
How do I handle a gift card value that is larger than the total?
You need to modify your custom calculation script to include an 'if' statement that prevents the total from falling below zero. For example, you can write logic that sets `event.value` to zero if the calculated final amount is negative.




