In my application I send HTML Email receipts to customers after finishing an order. What I would like to do is preview this in a webbrowser control.
The code I have works fine, but the images are missing in the browser.
I create the HTML in an AlternateView like this:
Dim hview As AlternateView = AlternateView.CreateAlternateViewFromString(ReadTemplate(order), Nothing, "text/html")
Then loop through the images they ordered and add them like this:
Dim M As New LinkedResource(ResizeAndRotate(I.Path), Net.Mime.MediaTypeNames.Image.Jpeg) With {.ContentId = "Main" & cnt}
hview.LinkedResources.Add(M)
Then return a document from the hview stream:
Dim ObjDoc As New HTMLDocument
Dim Doc As IHTMLDocument2 = ObjDoc
Dim reader As New IO.StreamReader(hview.ContentStream)
Doc.write(reader.ReadToEnd)
Return ObjDoc
How would I also get the images from the stream?
I don't believe that you can use images from memory. You'll need to save them to the hard drive, even temporarily. The you have to reference them in your HTML something like this: