1

I'm showing an HTML file (Documentation.html)'s content inside a webBrowser control. The HTML file is located as resource.

string htmlFile = Properties.Resources.Documentation;
webBrowser1.DocumentText = htmlFile;

There is an image inside Documentation.html which will be shown properly in any browser:

<img src="Resources/Image.png">

Unfortunately all the text of the HTML-file appears normally but not the image.

Can I set the images path to the resources (like Properties.Resources.Image) or something else?

Daniel B
  • 3,109
  • 2
  • 33
  • 42
vincentVega
  • 49
  • 1
  • 6

1 Answers1

2

You can embed the image's data in documentation.html file like

<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." /> 

ref: Embedding Base64 Images

You can do it either direcly or even by code like

htmlFile .Replace("Resources/Image.png", string.concat("data:image/png;base64," + imageData))

Daniel B
  • 3,109
  • 2
  • 33
  • 42