Embedding a file (pdf/excel) in CHM

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Erich Carshagen
Posts: 35
Joined: Mon Feb 13, 2017 4:25 pm

Embedding a file (pdf/excel) in CHM

Unread post by Erich Carshagen »

We are currently reviewing Help & Manual, and we would like to know how to embed a file in a CHM help file. We have various files that we cannot display in the help directory (not even as hidden files), but the help users should be able to open the files in the relevant app from the CHM. An example of this is an excel file (.xls/.xlsx) with headers as an import example. This file should not be available in the help directory as an individual file, but it must be available from within the CHM.

We have linked the file and it opens when the file is in the same directory as the chm file, but as soon as we move the chm, the link does not open the file until we move the file to the chm directory.

Can you let us know how to embed a file in chm?

Thanks
Erich
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Embedding a file (pdf/excel) in CHM

Unread post by Tim Green »

Hi Erich,

You just need to add the PDF file to your "Baggage Files" to compile it into the CHM and then link to it using Internet links with a special syntax. Also make sure that the file names contain no spaces, accented characters or other non-alphanumeric characters except for - and _:

1: Add PDF to your baggage
In the Project Explorer, go to Project Files > Baggage Files > Baggage and select "Add File" in Topics > Manage Topics in the Project tab and add the PDF file to the Baggage. This will pack the PDF into the CHM in your output.

2: Create your links
Select the Link tool in the Write tab to create a link in the Help & Manual editor and select the option "Internet Link". Set the "Target Window" option to "Same as referring topic". This is essential, it won't work without this setting. Then enter the link in the Address: field with either of the two syntaxes, replacing the bold text with the names of your CHM and PDF files:

mk:@MSITStore:helpfile.chm::/filename.pdf

ms-its:helpfile.chm::/filename.pdf

In the past the first version used to open in an external window and the second version inside the CHM viewer, but in recent versions of Windows both open inside the CHM viewer.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Erich Carshagen
Posts: 35
Joined: Mon Feb 13, 2017 4:25 pm

Re: Embedding a file (pdf/excel) in CHM

Unread post by Erich Carshagen »

Hi Tim,

Beautiful! Exactly what we are looking for!

Will let you know if we have any further questions.

Thanks for the assist!
Erich
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Re: Embedding a file (pdf/excel) in CHM

Unread post by John Johann »

Been experimenting with this for opening a PDF file from the TOC in the CHM file.

0. Add the pdf to the baggage
1. In the TOC
2. Insert new topic
3. TOC link
4. Define Heading
5. Link to web address
6a. Web address --> mk:@MSITStore:helpfile.chm::/filename.pdf
6b. Web address --> ms-its:helpfile.chm::/filename.pdf
6c. Web address --> filename.pdf

Only 6c works.
6a and 6b give a page cannot be displayed error

Going on from that, I tried the same with an mp4 and a wmv file -- neither worked.

If the video is in the baggage files, it gets compiled with the rest, but it does not play.

If I use insert local video, I have to distribute the video and the chm even though the video is in the chm.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Embedding a file (pdf/excel) in CHM

Unread post by Tim Green »

Hi John,

DON'T try to insert PDFs via links in the TOC. Even when it works, that creates a terrible, confusing browsing experience. I only described linking to PDFs for a reason.
Going on from that, I tried the same with an mp4 and a wmv file -- neither worked.
No. You can't insert video files as TOC links. That wouldn't and couldn't work, by definition. Use the Media tool in the write tab to insert media like that in your topics.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Re: Embedding a file (pdf/excel) in CHM

Unread post by John Johann »

Hi Tim,
Thanks again.
I agree with your issue on PDF browsing experience -- however, I'm not the one that gets to decide :-). It was more a functionality test.

As far as videos are concerrned, I hoped to be able to embed them in the CHM via Baggage to only have to distribute one file, but the links to the file just don't want to work (inserted via the Media > Local Video tool).
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Embedding a file (pdf/excel) in CHM

Unread post by Tim Green »

John Johann wrote:As far as videos are concerrned, I hoped to be able to embed them in the CHM via Baggage to only have to distribute one file, but the links to the file just don't want to work (inserted via the Media > Local Video tool).
Microsoft used to allow embedding videos in CHMs in Windows 98 but it has been forbidden for many years now. This is not a restriction of Help+Manual. Microsoft actively prevents it through Windows and the CHM system.

If you want reliable video in CHM the only really acceptable way to do it now is with YouTube or Vimeo, because they will automatically generate the many different versions of your video file and the automatic switching between them for individual devices that is required for reliable video performance. (Online video is currently a total mess, but it is quite well hidden from the user that this is the case.) Second best is MP4 encoded with an Apple profile and stored in the same folder as the CHM, but that will still fail on quite a few systems.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Jennifer Carroll
Posts: 3
Joined: Thu Sep 22, 2016 9:22 pm

Re: Embedding a file (pdf/excel) in CHM

Unread post by Jennifer Carroll »

Does your solution apply to .xls/.xlsx files or do they need to be embedded?

We have tried numerous times to add one of these file types to the baggage folder, and then add a link to it from within a topic.

If I execute the link from within the editor window, of course it works fine, but does not work once we publish the CHM to our online help.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Embedding a file (pdf/excel) in CHM

Unread post by Tim Green »

Jennifer Carroll wrote:Does your solution apply to .xls/.xlsx files or do they need to be embedded?
We have tried numerous times to add one of these file types to the baggage folder, and then add a link to it from within a topic.
If I execute the link from within the editor window, of course it works fine, but does not work once we publish the CHM to our online help.
That depends on the file association of the files on the computer where the CHM is being viewed. Also, the file needs to be in the same folder as the CHM; you can't link to files anywhere else unless you provide a full absolute path, including the drive letter, which is normally a show-stopper on most installations since you cannot predict where your application and its CHM are going to be installed. You also need to make sure that all the extensions used are included in the embedding settings in Configuration > Publishing Options > PDF > PDF Layout.

All that being said, Windows' handling of links from CHM to the outside world has become increasingly restrictive over the years. A CHM file can technically be used to transport, install and execute malware and Microsoft is terrified of this happening, so they have increasingly battened down the hatches around the CHM system. It hasn't been updated or even bug-fixed since it was originally released with Windows 98, and none of the original developers are at Microsoft now. The CHM code itself is no longer being touched and is treated as a black box. Any changes or restrictions are applied externally, probably including ongoing patches to Windows to keep it working in new versions.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply