Crazy Idea #6,349: JavaScript in PDF

In reading through Bruno Lowagie's excellent book iText in Action, I noticed several references to JavaScript. I knew it was possible to do a lot of interesting things with PDF to promote interactivity. But JavaScript?

It turns out Adobe has even published about 1,000 pages worth of documentation on the subject in the form of the Acrobat JavaScript Scripting Guide and the Acrobat JavaScript Scripting Reference.

iText, the premier Java library for creating and manipulating PDF documents, supports JavaScript out of the box. The extent of this support is not clear to me yet, but the API does exist.

JavaScript has a lot of untapped potential for enhancing interactivity in cheminformatics. Similarly, PDF has a lot of untapped potential, which will be the topic of future articles.

What kinds of things could you do in cheminformatics by combining PDF and JavaScript?