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



Related Products at PDF Store

Nitro PDF Professional

Nitro PDF Professional, your PDF creation and editing product. Priced at $99, Nitro PDF Pro is the m... View full product details
Download free demo

ARTS PDF Aerialist

Take Acrobat to the next level with advanced splitting and merging; flexible bookmark creation and m... View full product details
Download free demo

ARTS PDF Crackerjack

Impose pages, automate your workflow, verify certified PDFs, print accurate colour separations, conv... View full product details
Download free demo

PDF In-Depth Free Product Trials Ubiquitous PDF

Nitro PDF Professional

the perfect PDF product for business and enterprise, combining an extremely competitive price with a...

Download free demo

XpdfViewer

This ActiveX control (OCX) provides a PDF file viewer component, enabling developers to add PDF viewing...

Download free demo

Ubiquitous PDF: Printable PDF 2010 calendars

With the new year just around the next bend, you might be looking to update your calendars. Thanks to Vertex42.com, users can now download and print a free PDF calendar for 2010. The page lets visitors select from a variety of styles and offers both yearly and monthly calendars.

December 10, 2009
Search Planet PDF
more searching options...







Create PDF Free

Most Popluar Articles
Planet PDF Newsletter
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.

Featured Product

Docmetrics

Generate more, higher-quality sales leads from your PDF marketing content. Docmetrics is a web-based system that lets you capture previously unavailable reader data. Free trial.

Platinum Sponsor
Create & Edit PDF - Nitro PDF Software

ARTS PDF

Silver Sponsors

PDF-Tools enfocus

QuickPDF: The Unrivaled PDF Developer Toolkit