PDF Portfolios and Backward Compatibility – Part 3

| No Comments

The first two parts of this discussion focus on backward compatibility and creating a good user experience. If you are interested in that please read the earlier posts here Part 1
and here
Part 2. This entry focuses on ensuring the user sees your PDF Portfolio in all it’s Flashy glory, that is, forcing it to be viewed in Acrobat or Reader 9.

We can use Acrobat JavaScript to control what happens when the document is opened. The application property "app.viewerVersion" will return the version number of Acrobat or Reader being used. Then we can use an "if" statement to branch the code. If the viewer number is too low, we can use "this.closeDoc()" to shut down the file. You’ll want to add this code to the Document JavaScripts outside of any function so that it runs every time the document opens. The code might look like this.

if (app.viewerVersion < 9)
{
//Add your own message or something here.

this.closeDoc();
};

Unfortunately, for security reasons, this.closeDoc() is not permitted to execute while a PDF is being viewed in the browser. To get around this limitation, I’ve also created a special link to the PDF that will prevent it from opening in the browser and ask the user to download it instead. This is also a great little trick to use for large PDF Portfolios that may take a long time to open in the browser.

The example file below will only stay open in Acrobat or Reader 9. If it is opened in an earlier version a dialog box (right) that I authored in WindJack’s AcroDialogs will appear explaining what’s happening.

Example Portfolio