JavaScript – Introduction to Development with Examples

Adobe Acrobat allows you to utilise JavaScript within Acrobat Forms by defining an object model on top of JavaScript 1.2. These objects are only defined within the Adobe Acrobat realm and are specific to Acrobat Forms. They mirror the Acrobat Forms components and give the forms developer a way to access these components programmatically in order to query and change their properties.

What is JavaScript?

JavaScript is the scripting language developed by Netscape Communications and is commonly used to create interactive Web pages. JavaScript v1.2 comes with six predefined classes: Boolean, Number, Date, Math, String, and Array. Additional classes and objects have been defined to allow access to portions of the PDF file.

Tutorial 1: Copying Fields

It often takes some intense manipulation of fields to get things just right on a form. Proper coloring, sizing, actions and JavaScripts all make up a field. It is often the case that you need to make a copy of a field within a form but did you know that you can save your form fields to a separate file and copy and paste them for later use? This tip shows you the three different forms of copying that are available in Acrobat Forms Author version 3.5 and higher. Control-Drag Copy, Clipboard Copy, Duplicate Fields

Tutorial 2: Making a Table

Many forms use tables or arrays of similar fields for adding numbers or detailing items. Purchase orders, expense reports, and bills of lading are just some examples of how groups of fields are used in this manner. Unfortunately, Acrobat Forms doesn?t include the ability to create arrays in an automatic manner. But with a little knowledge about accurate placement of fields, multiple selection and alignment, and the new grid feature, this can be a much less painful authoring procedure.

Tutorial 3: Formatting and Calculations

We now have an invoice that can be filled in, but it is rather dumb. A user must perform his own calculations to figure out totals and shipping. Fortunately, the latest version of the forms plug-in includes a JavaScript interpreter that will allow you to rectify this dismal situation. In particular, the format and calculations tabs are at your disposal.

Adobe Store order form

Add pizzazz to a company picnic… Reward an employee… Present an upbeat corporate image at a trade show.. This one is the grand-daddy of all examples here. You’ll see samples of all sorts of JavaScript in this one.

PDF Calculator

Improve your marks by downloading this all-purpose PDF calculator.

Photo Album

This photo album can be used to store all your family treasures.


We have Two Hundred and Eleven Million Nineteen Dollars and Twenty-Three Cents that says you’ll download this one, and change your name to ‘Lucky Guy’.

Tic Tac Toe

This old favorite is certainly worth a shot. Remember three in a row to win. Bring a friend

Credit Card tester

Need to validate a credit card? This sample does all sorts.

Date manipulation

This example shows how to manipulate dates using JavaScript. Because the values for Acrobat fields are strings, it is necessary to convert the string to a date using the date constructor.

Importing icons

This example allows a user to browse for an appearance and embed it into the form.

Business Card builder

Not only will this sample build you your business cards complete with photo, it also takes care of the envelopes and letterhead as well.

Lease Vehicle Receipt

See the contraversial scrape on the left bumper of this returned vehicle.

You May Also Like

About the Author: Planet PDF Team

Leave a Reply