I am using the WebBrowser Control in C# in an application to display HTML. All the data es from a database, so I am generating a full page with Inline-CSS in Memory and sending it to the browser.
But now I want to support images, which seems to be a problem because I do not want to store the images on Hard drive, not even in a Temp Directory. I am aware of the data: URI Scheme, but that seems to be too limited.
I wonder: Can I somehow use JavaScript to dynamically generate an image, given a stream of bytes, essentially mirroring the data: Scheme using JavaScript? Or is there some other way to display images, i.e. using GDI+?
I can make some assumptions about the images if required, i.e. I can force the user to specify width and height if required, but I cannot really enforce the position, it's HTML after all. I can also force all images being in a specific format, basically anything that could help solving this.
Edit: Could I maybe abuse something like VML to display Bitmap data? I can't use Canvas or SVG as it seems (both unsupported in IE and therefore in MSHTML?)
Edit 2: VML would work, but the processor load is insane. So I'll either implement a Webserver to serve files (like cassini) or try the Silverlight approach in my other question.
I am using the WebBrowser Control in C# in an application to display HTML. All the data es from a database, so I am generating a full page with Inline-CSS in Memory and sending it to the browser.
But now I want to support images, which seems to be a problem because I do not want to store the images on Hard drive, not even in a Temp Directory. I am aware of the data: URI Scheme, but that seems to be too limited.
I wonder: Can I somehow use JavaScript to dynamically generate an image, given a stream of bytes, essentially mirroring the data: Scheme using JavaScript? Or is there some other way to display images, i.e. using GDI+?
I can make some assumptions about the images if required, i.e. I can force the user to specify width and height if required, but I cannot really enforce the position, it's HTML after all. I can also force all images being in a specific format, basically anything that could help solving this.
Edit: Could I maybe abuse something like VML to display Bitmap data? I can't use Canvas or SVG as it seems (both unsupported in IE and therefore in MSHTML?)
Edit 2: VML would work, but the processor load is insane. So I'll either implement a Webserver to serve files (like cassini) or try the Silverlight approach in my other question.
Share Improve this question edited May 23, 2017 at 10:27 CommunityBot 11 silver badge asked Aug 3, 2009 at 13:04 Michael StumMichael Stum 181k119 gold badges409 silver badges541 bronze badges2 Answers
Reset to default 2If you are willing to add an extra layer of plexity to your application then you can embed a simple web server that can be used to serve the images. Using the System.Net.HttpListener you can setup your application to serve the images as requested. This should work, but it seems terribly hackish...
The img-tag supports inline data in its source attribute. So you can take your image data, base64-encode it, and store it inside the src attribute.
Look here for an example. og you can google for html embed image for more examples.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745249361a4618583.html
评论列表(0条)