These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Acrobat Automatic Version Check js not working

Paeon
Registered: Apr 12 2007
Posts: 30

I have entered a javascript code in Document Javascripts that should prevent any versions less than 7 from staying open.
 
Here is the code:
 
if (app.viewer < 7) {
app.alert ("You must have Adobe Acrobat Reader 7.0 or later to view this pdf. Please download a free Reader from Adobe's website, [link=http://www.adobe.com.]www.adobe.com.[/link]")
this.closeDoc(true)
}
 
However when I open (trial) the pdf in Acrobat 5 or 6 instead of my alert and autoclose, I get three alerts in succession:
 
There was a problem reading this document (9)
 
then:
This file may contain newer information than the viewer can support. Adobe recommends that you upgrade to the latest version....
 
But the document does not close.
 
So how can I make my javascript dominant over what I guess are the built in alerts of Reader 5 or 6?
 
Thanks
 
Greg

My Product Information:
Reader 5, Macintosh
pddesigner
Registered: Jul 9 2006
Posts: 858
The code is correct. It is exclusively for checking Adobe Reader version.

When adding features specific to Acrobat viewers version 6 and above, add JavaScripts at the document
level to assess viewer versions

//is the viewer version less than 7.0

if(app.viewerVersion < 7.0)
{
var msg = "Some features won't work in Acrobat viewer versions less than version 7.0.";
app.alert(msg);
}For features not executable in Adobe Reader, add a JavaScript at the document level to assess viewer types.

//is Reader (as opposed to Acrobat)

if(app.viewerType == "Reader")
{
var msg = "Filling out this form requires use of Acrobat Standard or Acrobat Professional.";
app.alert(msg);
}

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.

pddesigner
Registered: Jul 9 2006
Posts: 858
Try this Document JavaScript:


if (typeof(app.viewerVersion) !="undefined")
if(app.viewerVersion < 8.0)
{
var msg = "Not all features in this document work in Acrobat viewers lower than 8.0. Upgrade to Adobe Acrobat Standard 8.0 on Windows or Adobe Acrobat Professional 8.0 on either Windows or Macintosh before proceeding.";
app.alert(msg);

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.

eround
Registered: Aug 2 2007
Posts: 1
app.viewerVersion seems to have a bug in it. If you are using 7.08 or 7.09 of Reader or Pro it will return 7.08. It does the same with 7.05, 7.06 and 7.07. It returns 7.05. Has anyone else experienced this?