Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding images in CHM help file with Sandcastles

I am using Sandcastles to generate a CHM help file for my project. I want a standalone CHM file that I can distribute, preferably on its own.

The issue I have is that to embed images it appears that the image needs to exist on the user's system separately from the CHM file. When I view the source of my CHM file, it looks like:

<img src="C:\Users\me\Pictures\wave.jpg" />

So if I email my CHM file to someone and they do not have this image, it will fail. An alternative would be to do:

<img src="images/wave.jpg" />

And email this person a ZIP containing my CHM file and an images folder. This is not a very nice solution either in my opinion.

Is there any way to "embed" an image within a CHM file? Or is there a clean solution to this?

For the record, I am including this image via this XML code on my C# project.

/// <summary>
/// Lorem ipsum dolor sit amet, consectetur adipiscing elit.
/// Pellentesque quis tortor sit amet magna posuere sagittis. 
/// Integer aliquet nibh elit, ut porta ex laoreet et
/// </summary>
/// /// <remarks>A picture: <br />
/// <img src "C:\Users\me\Pictures\wave.jpg" />
/// </remarks>
like image 550
John 'Mark' Smith Avatar asked Sep 24 '14 09:09

John 'Mark' Smith


1 Answers

It's a Visual Basic sample only but I think C# is near by. I assume that you use sandcastle Help File Builder (SHFB).

If the images are not being used in MAML topics, just set the BuildAction in the SHFB project to Content and place them in an images folder. They'll get copied into the working folder automatically and compiled into the CHM help file.

Steps to import the [images]-folder into SHFB Project Explorer, not referenced by MAML topics:

  1. Select Add and Existing Folder... from tree context menu, select the [images]-Folder
  2. For each image-file, set BuildAction from Image to Content
  3. In SHFB, push the Build the help file button

After the build, you have a CHM help file with images.

I attached some snaps of the Visual Basic project, SHFB und the resulting CHM.

enter image description here

enter image description here

enter image description here

like image 172
help-info.de Avatar answered Sep 16 '22 17:09

help-info.de