ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Subject:   Detecting Acrobat Reader & others
Date:   2005-02-23 08:22:37
From:   Hulkman
Response to: Detecting Acrobat Reader & others

Here's the full javascript code to detect any version of Acrobat:


This works both for IE and NS and any version of Acrobat :)
Hope it helps someone!


the problem with the other scripts is that it doesn't work for Acrobat 7.0 as the type changed from PDF.PdfCtrl.version to AcroPDF.PDF.1


this code corrects that problem!


feedback appreciated!




var acrobat=new Object();


acrobat.installed=false;
acrobat.version='0.0';


if (navigator.plugins && navigator.plugins.length)
{
for (x=0; x {
if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1)
{
acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);


if (acrobat.version.toString().length == 1) acrobat.version+='.0';


acrobat.installed=true;
break;
}
}
}
else if (window.ActiveXObject)
{
for (x=2; x<10; x++)
{
try
{
oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
if (oAcro)
{
acrobat.installed=true;
acrobat.version=x+'.0';
}
}
catch(e) {}
}


try
{
oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
if (oAcro4)
{
acrobat.installed=true;
acrobat.version='4.0';
}
}
catch(e) {}

try
{
oAcro7=new ActiveXObject('AcroPDF.PDF.1');
if (oAcro7)
{
acrobat.installed=true;
acrobat.version='7.0';
}
}
catch(e) {}


}


1 to 2 of 2
  1. Detecting Acrobat Reader & others
    2007-06-30 10:53:39  WebMaMa [View]

  2. Detecting Acrobat Reader & others
    2005-04-15 15:01:58  jas1114 [View]

    • Detecting Acrobat Reader & others
      2005-04-18 06:21:43  ales78 [View]

      • Detecting Acrobat Reader & others
        2005-05-03 13:53:29  attheshow [View]

        • Detecting Acrobat Reader & others
          2006-11-24 05:58:39  ramprakash [View]

        • Detecting Acrobat Reader & others
          2006-11-24 05:58:09  ramprakash [View]

1 to 2 of 2