O'Reilly logo

Adobe AIR 1.5 Cookbook by Koen De Weggheleire, Koen DeWeggheleire, Marco Casario, David Tucker, Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. PDF Support

Detecting Whether PDF Support Is Available

Problem

You want to detect whether the user is able to display PDF content in your AIR application.

Solution

Read the value of the HTMLLoader.pdfCapability property to check that the user has a version of Adobe Reader or Adobe Acrobat 8.1 (or newer) installed.

Discussion

The HTMLLoader.pdfCapability property is set to one of the following constants of the HTMLPDFCapability class:

  • HTMLPDFCapability.STATUS_OK

  • HTMLPDFCapability.ERROR_INSTALLED_READER_NOT_FOUND

  • HTMLPDFCapability.ERROR_INSTALLED_READER_TOO_OLD

  • HTMLPDFCapability.ERROR_PREFERRED_READER_TOO_OLD

If the property has the value of the constant HTMLPDFCapability.STATUS_OK, then you are sure that PDF content can be loaded into the HTMLLoader object. It also can happen that the user does not have the right version of Adobe Reader installed. If the installed Adobe Reader version is too old, then the constant ERROR_INSTALLED_READER_TOO_OLD is returned when you call the HTMLLoader.pdfCapability property. If the user has different versions of Adobe Reader installed but the one that is set up to handle PDF content is older than Adobe Reader 8.1, the constant ERROR_PREFERRED_READER_TOO_OLD is returned. If the user has no version of Adobe Reader installed at all, then the HTMLLoader object will not be able to display any PDF content.

Working with PDF content on Windows involves one other important caveat. If Adobe Acrobat or Adobe Reader version 7.x (or newer) is opened on the user’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required