Email this Page Log Support Call Send Feedback Print

Previous Topic

Next Topic

Book Contents

Book Index

Linking to An External File from HTMLHelp

Often we are asked how to link to an external file (such as a PDF) from a CHM (HTML Help) file.

You can create an external hyperlink to a .pdf file but when using HTML Help, this only works by using a fully qualified external URL, and having the link open a browser session containing the linked files - so the file would need to be held on a web server. I understand this is a limitation of HTML Help, and related to its internal compiled structure. You'll find using just the filename works fine in the plain HTML output.

There is an alternative approach which involves using HTML code that creates a Shortcut, but it's important to note that this functionality is specific to HTML Help, so only works in HTML Help.

If the Book is being published in both HTML Help and plain HTML, you need to use a fully qualified URL.

An example of the code is as follows. It will vary slightly for each document so you need to create the HTML code for each document and insert this for each document you wish to open :

<OBJECT id=hhctrl type="application/x-oleobject"

classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"

codebase="hhctrl.ocx#Version=4,73,8412,0"

width=100

height=100>

<PARAM name="Command" value="ShortCut">

<PARAM name="Button" value="Text:Document">

<PARAM name="Item1" value=",document.pdf,">

</OBJECT>

Where Document is the name you want to appear on the Button, and document.pdf is the file you wish to open. You can replace the parameter Button with Text and this will result in a text link as opposed to a button.

To use this code within Author-it:

  1. Create this code with a text or HTML editor (Notepad works fine) and save it as an .htm file.
  2. Create a File Object in Author-it that links to this HTML code
  3. Insert the File Object into your Topics and publish your Book.

If you use this approach, the file/s you are linking to must be in the same directory folder as the CHM file at runtime. You can add the PDF as an additional file to the file object used to add the HTML code. Under the HTML tab of the File Object, ensure that the source type is set to Linked Coded HTML File, and select the [>>] button next to the Additional Files - choose "Add" and navigate to and select the PDF file. Author-it will then copy this file to the Publishing folder for this Book each time you publish HTML or HTML Help.

It's also important to note that when you open the CHM from the Author-it publishing window the link won't appear to work. It does work correctly when you open CHM file from Windows Explorer.

Top of Page Email this Page Log Support Call Send Feedback Print