PDF In-Depth

Acrobat in the Browser

HTML Listing

Advertisement
 

This is the listing of the HTML/JavaScript that I used to determine the Version of Acrobat being used. It's far from complete but should be a good platform for further enhancements for your own customisations/requirements.






HTML Code (1 of 5)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="JavaScript">
<!--
    function AcroPluginCheck()
    {
        var agt=navigator.userAgent.toLowerCase();
        
        if(agt.indexOf("msie") != -1)
        {
            IEShowVersionInfo();
        }
        else if(agt.indexOf("mozilla") != -1 &&
            ((agt.indexOf("netscape") != -1) ||
            (agt.indexOf("; nav") != -1)))
        {
            NNShowVersionInfo();
        }

    }
HTML Code (2 of 5)
    function NNShowVersionInfo()
    {
        
        if (navigator.plugins &&
        navigator.plugins["Adobe Acrobat"].description != "") 
        {
            var description =
            navigator.plugins["Adobe Acrobat"].description; 
            var regEx = /(\d+)/;
            var version = 0;
            if(regEx.test(description))
            {
                version = RegExp.$1;
            }
            
            alert("The Version of Acrobat is: " + version);

        }
        else
        {
            alert("No Plugin Found for Acrobat.");
        }
        
    }
HTML Code (3 of 5)
    function IEShowVersionInfo()
    {
        var acrobatVersion = 0;
        var cnt = 0;
        var update = "No";
        var tmpArray = new Array();
        var pluginArray = new Array();
        var htmlData = "<table border=1><tr><th>#</th><th>Acrobat
        Component/Plugin</th><th>Version Number</th></tr>";

        // Call the ActiveX Object and get the Version Information
        var versionData = Pdf1.GetVersions();

        // Create an Array of all of the Plugin Names
        var versionDataArray = versionData.split(",");

        if(versionData.indexOf("6.0.0") != -1)
        {
            acrobatVersion = 6;
            if(versionData.indexOf("6.0.1") != -1)
            {
                updater = "Yes - 6.0.1";
            }
        }
        else if(versionData.indexOf("5.0") != -1)
        {
            acrobatVersion = 5;
            if(versionData.indexOf("5.0.5") != 1)
            {
                updater = "Yes - 5.0.5";
            }
        }
HTML Code (4 of 5)
        for(var x = 0;x<versionDataArray.length;x++)
        {
            tmpArray = versionDataArray[x].split("=");
            
            // The First element in the array is the Name of the Acrobat
            Plugin
            pluginName = tmpArray[0];

            // The Second element is the version of the Plugin
            pluginVersion = tmpArray[1];

            // There are blank values and entries in the list that aren't
            defined.
            if(pluginName != undefined && pluginVersion != undefined)
            {
                htmlData += "<tr><td>" + (++cnt) + ".</td><td>" +
                pluginName + "</td><td>" + pluginVersion +
                "</td></tr>";
            }
            //alert(pluginVersion);
        
        }
        htmlData += "</table>";
        document.write("<h2>You are running Acrobat Version: " +
        acrobatVersion + "<br>" + "Updater Installed:  " +
        updater + "</h2>");
        document.write(htmlData);
        
    }
//-->
</script>
</HEAD>
HTML Code (5 of 5)
<BODY>

<object
  id="Pdf1" 
  classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" 
  width="0" 
  height="0">

<form name="acro">
                  <input type="button" value="Acrobat Plugin Check"
                    onClick="AcroPluginCheck()" name="goCheck">
</form>

</BODY>
</HTML>
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

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
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.

Features

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.