Check if adobe reader is installed on client machine

Leo picture Leo · Nov 11, 2009 · Viewed 8.5k times · Source

Currently I am working on a web page which will tell user about certain configurations on client machine. Out of this there is also requirement of detecting if Adobe Reader is installed on client machine or not. I am using ASP.NET/C#.

I have looked the following url for the answer "Check Adobe Reader is installed (C#)?" but the code look into the server registry entires where IIS is installed and not the client machine where browser is running.

Is it possible to detect if Adobe reader is installed on client machine and not the server which is hosting the website?

Answer

serge_gubenko picture serge_gubenko · Nov 11, 2009

pls, check the script below, it worked fine for me in IE, FireFox and Chrome

<html>
<body>
<script type="text/javascript">
var found = false;
var info = '';

try 
{    
    acrobat4 = new ActiveXObject('PDF.PdfCtrl.1');    
    if (acrobat4) 
    {      
        found = true;      
        info = 'v. 4.0';    
    }  
}  
catch (e) 
{
    //???
}

if (!found)
{
    try 
    {
        acrobat7 = new ActiveXObject('AcroPDF.PDF.1');
        if (acrobat7) 
        {
            found = true;
            info = 'v. 7+';
        }
    } 
    catch (e) 
    {
        //???
    }

    if (!found && navigator.plugins && navigator.plugins.length>0)
    {
        for (var i = 0; i<navigator.plugins.length; i++) 
        {                           
            if (navigator.plugins[i].name.indexOf('Adobe Acrobat') > -1)
            {
                found = true; 
                info = navigator.plugins[i].description + ' (' + navigator.plugins[i].filename + ')';
                break;
            }
        }
    }
}

document.write("Acrobat Reader Installed : " + found);
document.write("<br />");
if (found) document.write("Info : " + info);
</script>
</body>
</html>

hope this helps, regards