Creating Auto-Calculating Form Fields
A friend of mine has started a little company she runs from the comfort of her own home: She makes wake-up calls to people who don’t trust their alarm clocks (though why they’d trust her alarm clock, I couldn’t say). It’s not extremely profitable, but seems to keep her in beer money.
Every month, she bills her customers for services rendered using a PDF form, a simplified version of which is shown in Figure 1. It’s a straightforward form: how many wake-up calls, how much per call, and the final bill. The form’s only weakness is that it could be more than it is. The three “total” fields (labeled Wake-ups charge, Snoring surcharge, and Monthly Total in the figure) are just Text fields; my friend calculates the totals herself and enters them into the appropriate fields.
Figure 1 We’re going to turn some of the form fields in this PDF file into auto-calculating fields.
As it turns out, Acrobat can do calculations just as well as my friend can (better, maybe); in particular, it’s perfectly easy to have the totals fields calculate their own values.
That’s what we’re looking at in this article: How do you tell a form field to calculate its own value?
I should warn you that this is an intermediate topic; in particular, I assume you know how to create form fields on an Acrobat page. (You might take a look at the excellently writtenwhy, yes, I did write itAcrobat X Visual Quickstart Guide for an introduction to creating Acrobat forms.)
Our Sample File
The sample file for this article, pictured in Figure 1, is a simple form that collects the number of wake-up events during a single month. Note that Acrobat highlights the form fields in blue so you can see them on the page; if this annoys you, you can turn it off by clicking the Highlight Existing Fields button at the top of the window (Figure 2).
Figure 2 You can turn off the blue highlighting of a file’s form fields, if it annoys you.
As always, this file is available for downloading from http://www.acumentraining.com/resources.html; look for the file Auto-calculate.zip.
We’re going to turn three of the fields in this form into self-calculating fields: the Wake-up charge field, the Snoring surcharge field, and the Month’s Total field.
Let’s do it.