Page view counter

Detect adobe reader installed in C#.net page load

Last post 05-25-2007 4:32 PM by Puhfista. 2 replies.

Sort Posts:

  • Detect adobe reader installed in C#.net page load

    04-11-2007, 1:49 AM
    • Loading...
    • karnan
    • Joined on 04-11-2007, 5:19 AM
    • Posts 4
    • Points 2

    Detect adobe reader installed in C#.net page load . I have to show the client a message in page load and save the value in database(ie. whether adobe is installed or not).I have a problem if i use hidden field and javascript . I am unable to get javascript return value in hidden field in page load.

    If i use _doPostBack("hidAcrobat","1"); the page get refreshed.

    Can anybody suggest regarding this...

    Thanks,

    Karnan.S

     

     

     

     

  • Re: Detect adobe reader installed in C#.net page load

    04-11-2007, 6:35 AM
    • Loading...
    • eshwar
    • Joined on 07-04-2006, 6:24 AM
    • Hyderabad
    • Posts 7
    • Points 32

     

     Hai,

      Just use this piece of javascript function code to detect Acrobat reader. This code gives the version of acrobat also. Just alert the acrobat.installed variable to the client user which solves your problem.

     
    <script language="javascript">

    function detectAcrobat()

    {
    var acrobat=new Object();

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

    if (navigator.plugins && navigator.plugins.length)
    {
    for ( var x = 0, l = navigator.plugins.length; x < l; ++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) {}

    }
    alert(acrobat.installed);
    alert(acrobat.version);

    }
    </script>
     

     I hope this could solver your problem....

    Thanks,

    eshwar.
     

    My Dream is to be in your Dreams...
    http://eshwar123.blogspot.com
  • Re: Detect adobe reader installed in C#.net page load

    05-25-2007, 4:32 PM
    • Loading...
    • Puhfista
    • Joined on 03-07-2006, 11:29 PM
    • Logan, Utah
    • Posts 47
    • Points 136

    Hi, thanks for the post.

    This isn't correctly detecting Adobe Reader on firefox. It works fine for me on IE. I am using the real Adobe Acrobat (I don't know if it makes a difference).

    Any idea why this is? 

Page 1 of 1 (3 items)