How to Add Calculations to a PDF Form (Totals, Tax and Discounts)
2026-10-13 · CraftingPDF
A PDF form that does its own maths saves time and removes arithmetic mistakes. Invoices, quotes, order forms, timesheets and expense reports are the most common examples.
What is a calculated field?
A calculated field is a form field whose value is worked out from other fields. When someone changes a quantity or a price, the total updates immediately. The person filling the form cannot type over it, so the number stays reliable.
Common calculations
- Sum: add a column of line totals into one subtotal.
- Product: quantity multiplied by unit price.
- Percentage: tax, tip or a commission.
- Discount: subtract a percentage or a fixed amount.
- Date maths: due date as invoice date plus 30 days.
Example: a simple invoice
- Each row has Quantity and Unit Price fields.
- A Line Total field multiplies them.
- A Subtotal field adds all the line totals.
- A Tax field multiplies the subtotal by your tax rate.
- A Total field adds subtotal and tax.
Name the fields clearly (qty1, price1, total1 and so on) so the formulas stay easy to read and maintain.
Make calculations reliable
- Set the format. Use a currency or number format with a fixed number of decimals so 10 does not appear as 9.9999999.
- Handle empty rows. A blank row should count as zero, not cause an error.
- Lock the results. Mark calculated fields as read-only.
- Set the calculation order. If one result feeds another, the calculation order must follow the chain.
- Test edge cases. Try zero, very large numbers and decimals.
Beyond simple maths
Advanced forms can also show or hide sections based on answers, validate entries (for example a ZIP code) and pull values from a dropdown, such as a different price for each product. These rules use JavaScript inside the PDF, which is where an experienced developer saves a lot of time.
Need a smart form built for you?
We build calculation-enabled forms for quotes, orders, medical intake and field service work. Take a look at our Smart PDF Forms service or send us your form for a quote.