Determining the Adobe Acrobat Reader Version
Many times during development and deployment, it is critical to understand which
version of Acrobat or Adobe Reader your customer is using. You will want to ensure the version they have available is compatible with the solution you are deploying. To determine the version of Acrobat/Reader, you can add a JavaScript to the document-level of the PDF file. As the file loads, this will ensure that the file is compatible with the version of Acrobat. The following tip outlines a sample JavaScript – one for PDFs created with Acrobat Form Tools, and one for PDFs created with Adobe LiveCycle Designer — to determine current version. Regardless of how you created the form you will need some common methods: app.viewerVersion : tests the version number app.viewerType : tests which tool you are using (Reader or Acrobat) app.formsVersion: tests the major version of the forms plug-in However, app.formsVersion will give you the major version (i.e. 7) but not the minor version (i.e. 7.0.3). Therefore you need to test the Forms plug-in directly for version number. You will want to parse through all the installed plug-ins, and check the version of ‘Forms’:
for (var i = 0; i < app.plugIns.length; i++) { if (app.plugIns[i].name == “Forms”) { var minorFormVersion = app.plugIns[i].version; } }
So, I created a form with two fields: • a multi-line text field to display the version values (myTextField) • a button field to execute the JavaScript (myButton)
Figure 1
Adobe helps people create, manage, and deliver the highest quality digital content in the world.
Better by Adobe.™
Adobe Systems Incorporated
345 Park Avenue, San Jose, CA 95110-2704 USA
www.adobe.com
Adobe, the Adobe logo, Acrobat, Adobe LiveCycle,Reader, Acrobat are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. All other trademarks are the property of their respective owners.
© 2005 Adobe Systems Incorporated. All rights reserved.
09/05
This JavaScript works with both Acrobat Forms and Designer Forms. The JavaScript on the button field is as follows:
var formVersion = app.formsVersion; var viewerVersion = app.viewerVersion; var viewerType = app.viewerType; for (var i = 0; i < app.plugIns.length; i++) { if (app.plugIns[i].name == “Forms”) { var minorFormVersion = app.plugIns[i].version } } var strVersionCheck = “Viewer Version = “ + viewerVersion + “ + “Viewer Type = “ + viewerType + “ + “Major Form Version = “ + formVersion + “ + “Minor Form Version = “ + minorFormVersion; // For Acrobat Forms: this.getField(“myTextField”).value = strVersionCheck; // For Designer Forms: xfa.resolveNode(“F.P1.myTextField”).rawValue = strVersionCheck;
After selecting the button: Try it yourself with the button to the right.
Figure 2 |
Comments