PDF In-Depth

Acrobat in the Browser

About the Author
 
Dave Wraight picture

Dave Wraight

Dave Wraight has been actively involved with PDF since version 1.0 and today heads PDF software and resource company AcroTips.  More


 

 
 

If you've ever had the need to determine what version of the Acrobat Browser Plugin your web visitors are using then perhaps we can shed some light on how to find this information.

Using some simple JavaScript, it's possible to determine a whole range of version information from the PDF Viewing Component inside a Web Browser.

As the ActiveX Control (pdf.ocx) is undocumented and unsupported by Adobe Tech Support, programming with it can be wasted effort.

The other thing to note is that Internet Explorer and Netscape Navigator provide this information in two totally different ways -- surprise, surprise ;)

Internet Explorer

To find out the version of Acrobat being used inside Internet Explorer we need to create an Object from the 'pdf.ocx' ActiveX control.

To accomplish this we need to know the Class ID of the Object we are to embed. Using Microsoft's ActiveX Control Pad you can easily do this (see references at the bottom of the page). Alternatively you can look in the registry against the PDF.PdfCtrl.6 entry (CLSID).

The Class ID for the pdf.ocx for Acrobat 5/6 is:

CA8A9780-280D-11CF-A24D-444553540000

The ClassID for earlier versions may be the same, but as I no longer have these version installed I'm unable to find this out.

In a normal HTML page we add the following Tag:

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

I generally put these right after the BODY tag so they are processed first as the browser parses the HTML.

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

Once the page is processed you will have a reference to the ActiveX Control (pdf.ocx) by using the object name 'Pdf1'.

By using some JavaScript we can get access to the Version information contained inside the object. The code section at the bottom of this article details the JavaScript I've used.

In brief we basically ask the 'Pdf1' object to give us a list of the version numbers (GetVersions()), we can then do a quick check to see if this information has the numbers 6.0.0 or 5.0.0 (an also the updaters (5.0.5 and 6.0.1).

That code could be as simple as:

if(Pdf1.GetVersions().indexOf("6.0") != -1)
    alert("Acrobat 6 Found")

Netscape Navigator

As I mentioned before NN has a different approach when it comes to plugins.

There's an object in Netscape to provide access to plugins, it works like this:

var pluginName = navigator.plugins["Adobe Acrobat"].description;

if(pluginName.indexOf("6") != -1) 
    alert("Acrobat 6 Found")

Because there's no ActiveX object to reference we can simply put this code (and obviously more) into a function and call it from an onLoad or onClick event handler.

Summary

Hopefully the code listings and the explanations should be enough to get you started, the Adobe Acrobat TechDoc listed in the reference section may also help.

Dave......

References

  1. ActiveX Explorer
    http://www.alteviltech.com - This application provides very detailed information for Type Libraries, ActiveX Components and other Windows components.
  2. MS ActiveX Control Pad (Free)
    The ActiveX Control Pad, inserts the ClassID for the Browser PDF Control (pdf.ocx). It's also capable of showing the Procedures and Functions available in any ActiveX control.
  3. Adobe TechNote #51621
    This technote formed the basis for this article.
  4. Example HTML File Complete
    Code also listed below



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

PDF Master Series III: Eugene Y. Xiong talks with Planet PDF

Planet PDF talks with another Master of the PDF Universe, Eugene Y. Xiong, Founder and Chairman of the Board at Foxit Software Inc. in Fremont California. Xiong is a quiet yet astounding achiever, you (usually) won't find him talking at conferences, exhibits, or publishings, but what you will find is the result of his leadership in places you would never expect.

September 14, 2016
Platinum Sponsor



Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist 12

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.