PDF In-Depth

Undocumented PDF JavaScript Function

April 11, 2000


Seems there is at least one undocumented (but live and ready to use) function lurking under PDF JavaScript's hood, that nobody outside of Adobe knows about. Except, now you are going to know about it, thanks to today's article! (Didn't I tell you it would be worth your while to keep tuning in to this page?)

Ready? Here it is. It's a method that belongs to the App object, called popUpMenu (note the capital letters). The usage is like this:

var fnt = app.popUpMenu("Times-Roman","Helvetica","Courier");
var f = this.getField("MainWindow");
f.textFont = fnt;

What happens is that if you (for example) attach the foregoing 3 lines of JavaScript to a button's mouse-up event, you'll cause a button hit to pop up a menu of typeface choices, from which the user can choose a new font for the text field named MainWindow.

The popup menu you get when you implement this function does truly "pop up" out of nowhere, and it functions correctly in that the selection you make takes effect the instant you let go of the mouse button. So, it's a wonderful little function (IMHO). Given its wonderfulness, I asked an Adobe engineer why it wasn't documented. He as much as said that Adobe QA (quality assurance) wouldn't give a "pass" to it for commercial release, because it "didn't behave well enough." He wasn't any more specific than that. I haven't beat on it very much, but to me it behaves wonderfully and I intend to use it a lot. The same engineer that I talked to told me that popUpMenu() will not be deprecated in the future but in fact will undergo some tweaks in order to make it prime-time ready for Acrobat 5.

So there you go. You now have in your hands an Acrobat 5.0 feature, that no one else knows about! Use it responsibly.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.