Opening PDF Files in WinHelp

WinHelp can open PDF files directly by using the ExecFile macro in either a link or a WinHelp macro button.

A simple line like:
Open PDF
!ExecFile(`brochure.pdf') normally opens the PDF into it's own viewer. However, if users do not have Acrobat Reader, they will encounter an error message.

The best way to deal with this problem is to use the IfThenElse (IE) macro.  The IfThenElse macro was covered extensively in the September 2000 - RoboHelp Tip, so check out how to use the macro by following that link.

The IfThenElse macro for the above example would look like:

Open Brochure!IE(FE(`brochure.pdf'),"EF(`Brochure.pdf',`',SW_RESTORE,`')","PI(`',`Sorry')")

The Macro Wizard would look like the following once complete:

What happens if the PDF is not present, or the user does not have Acrobat Reader? The following popup topic named Sorry appears.

Next, Opening PDFs from HTML Help