PDF Calculated Fields

When it comes to creating files with calculations, your first thought is probable using Excel or Google sheets, but it's not practical to send these to customers if the file is an invoice for example.

Adobe has a great set of tools for creating calculated fields and in this blog, I will show you just how easy it is to do just that.

To follow along with this example, you will need to have Adobe Acrobat Pro installed on your machine.

Custom Calculations

To start, open up Acrobat Pro and under tools click on 'Prepare Form', then select 'Create New', this will create a new PDF file that we can use for our PDF form.

Once done do the following:

  1. Click on 'Add a Text field' and name it Qty
  2. Click on 'Add a Text field' and name it Price
  3. Click on 'Add a Text field' and name it qtyxprice

Repeat the above naming the field names - Qty2, Price2, and qty2xprice2

Next steps are below:

  1. Click on 'Add a Text field' and name it netAmount
  2. Click on 'Add a Text field' and name it vatRate
  3. Click on 'Add a Text field' and name it vat
  4. Click on 'Add a Text field' and name it grossAmount

Now we can format the fields, double click on Qty and select format, from the 'Select format category:' select number for the form field. Repeat for price and this time for Currency Symbol: select the £ symbol or your chosen currency.

Repeat the above for qtyxprice and then repeat again for the other form fields and also add text fields.

Once complete you should have something similar to the image below.

Calculated fieldsNow its time to add our calculated fields, double click qtyxprice and select 'Calculate' then 'Custom calculation script:' and enter the following code.

Repeat the above for qty2xprice2 and add the following code:

For the net amount field, double click and under 'Value is the' select sum(+) and then click on pick and select qty2xprice2 and qtyxprice as the image below shows.

Text field propertiesFor the VAT form field, enter the code below.

Finally, for the gross amount select the values as shown below.

Properties GrossOnce done we can preview the PDF document and now enter values into the fields and the calculated fields will update with the math calculations in the PDF fields. Adobe PDF Working example with calculated fields

I hope you found this blog helpful, if yes please leave a comment below.

The PDF file can be downloaded here

 

 

Leave a comment

*
*