Accessing the Acrobat Doc Object in LiveCycle Designer

Users thinking of moving their PDF forms over to Adobe LiveCycle Designer need to realize that there are some fundamental differences between forms created via Adobe Acrobat and those created with Designer. The underlying difference is the fact that forms created with Designer are based on the Adobe XML Form Object Model, which is differs from the Document Object Model (DOM) of those created via Acrobat.

Note:
More information on the Adobe XML Form Object Model can be found in the reference document at Adobe’s site.

So what about all the JavaScript code you may have written in the past to enhance your PDFs? Can that still be used in Designer, or do you have to learn all new ways of doing things? Well there’s some good news there, as you should find that all the objects (i.e. App, Console, Util, etc.) found in the Acrobat JavaScript Reference document will work in forms created in Designer. There’s one exception to this, and that is when you’re wanting to access the Acrobat Doc object.

Accessing the Doc object

To write against the Doc object you first need to retrieve it using the following piece of code.


var objDoc = event.target;

This stores the Doc object in the objDoc variable, which can now be used to write code against the Doc object. This example accesses the PDF’s Doc object and sets the document zoom level to 75%.


var objDoc = event.target;
objDoc.zoom = 75;

Accessing the other objects

No special tricks are required for accessing the objects besides the Doc object, just write your code as though you were doing it in Acrobat. For example, to check what version of Acrobat/Reader the user is running and write it to the Acrobat console you would just use the normal code:


var version = app.viewerVariation + ' ' + app.viewerVersion;
console.println('The user is running ' + version);

More Info

You May Also Like

About the Author: Chris Dahl

Leave a Reply