Q: How can I create PDF interactive forms that have auto calculations on them?

A: PDF Studio 9 and above is capable of creating PDF forms with custom calculations. You have the ability to use some of the preset simple calculations or advanced custom calculations using JavaScript. This is very useful for when you want values entered into a form calculated automatically. For example: summing up a total on an invoice sheet to give to a customer.

Below are the steps used to setup the calculation function within a PDF document.

Adding Calculations to Forms

  1. Open the document that you wish to add calculations to
  2. Make sure you are in the Form Field editing mode. On the menu bar select Forms->Create/Edit Form
  3. Create.Edit form menu
  4. Make sure to create all of the Text Fields that you need in the document first. For more information regarding  on how to create Text Fields see Creating Text Fields. Make sure that you have correctly named all of the Form Fields in your document to make it easier to setup the calculations
  5. Select the Text Field that you would like to perform the calculation and open up the Text Field Properties. This can be done by either double clicking on the field, or right clicking and selecting Properties.
  6. Form field properties
  7. In the Properties window select the Calculate tab
  8. Text Field Calculate
  9. On this screen you will see your options available to set calculations. You have two available options:
    • Simple Calculation – This option allows you to create simple calculations using the fields on the form.
      • To setup the Simple Calculation, first select the option for “Field value has a simple calculation:
      • Then select the type of calculation you would like from the drop down menu.
      • Text Field Calculate - Simple calc option
      • Select the fields from the list you would like to be included in the calculation. To select more than one field from the list either click and drag the mouse or hold Ctrl and click the fields that you need from the list. Only highlighted fields will be used in the calculation. (You can also select other fields such as Combo or List Boxes to be used in calculations)
      • Text Field Calculate - Simple
      • You have the below options available for simple calculations:
        • Sum (+) – adds the fields together
        • Product (x) – multiplies the fields together
        • Average – returns the average value of all the fields
        • Minimum – Returns the lowest value from all the fields
        • Maximum – Returns the highest value of all the fields
    • Custom Calculation – The Custom Calculation allows you to perform more advanced calculations using Javascript. You will need to have advance knowledge in programming JavaScript in order to create the actions for the buttons. For more information regarding JavaScript in PDF Studio see Supported JavaScript

      • To setup the Custom Calculation select the option for “This field has a custom calculation:” and type in the JavaScript calculation that you would like to perform.
      • Text Field Calculate - Custom Calc
  10. Once you have completed setting either a Simple or Custom calculations click on OK
  11. Repeat steps 1- 10 to create as many List Boxes as you need.
  12. Once complete click on the Stop Form Editing button on the toolbar to close the form editor and save the document
  13. The Form Calculations will now be ready for you to use