Embedding images in CHM help file with Sandcastles

爷,独闯天下 提交于 2019-12-23 09:10:02

问题


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>

回答1:


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.



来源:https://stackoverflow.com/questions/26013972/embedding-images-in-chm-help-file-with-sandcastles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!