It's not just for calculating totals.
console object in the Acrobat DOM, and it logs any exceptions and the output of
Going beyond Acrobat
This power can also be used for good - if you know your PDF will always be displayed using the BFO PDF Viewer, you have the whole Java API available to turn your PDF into a much more interesting experience - and not just for the person that now has to debug them! As an example, the
javax.swing.JOptionPane class can be used to open a dialog and prompt the user for further information.
A Simple Worked Example
Next we need a webserver. We're using Tomcat but this example doesn't have any server-side component so you can use anything you like. Unzip the test.zip example under your webserver's document folder, and point your browser to the
index.html in that directory.
This will load a page containing an applet which will load the PDF we've just described above.
testjs.fdf file. FDF here stands for "Forms Data Format", and it's one of several file formats that can be used to import/export data from a PDF. The FDF is included in the zip file above.