Participant
1510 Points
306 Posts
Sep 01, 2012 12:04 PM|ozkary|LINK
The System.Drawing.Image.FromStream class expects a stream with bytes from an image. You are passing html instead which is not the expected format. To verify this, replace your url to download a specific image like:
System.Net.WebRequest webRequest = WebRequest.Create("http://localhost:58534/EFTestApp/images/animage.jpg");
Your current code should work.
To capture a screen shot of a webpage, you could use the WebBrowser class which has this method DrawToBitmap.
hope it helps
Participant
1510 Points
306 Posts
Re: how to create image from page html passing as string
Sep 01, 2012 12:04 PM|ozkary|LINK
The System.Drawing.Image.FromStream class expects a stream with bytes from an image. You are passing html instead which is not the expected format. To verify this, replace your url to download a specific image like:
System.Net.WebRequest webRequest = WebRequest.Create("http://localhost:58534/EFTestApp/images/animage.jpg");
Your current code should work.
To capture a screen shot of a webpage, you could use the WebBrowser class which has this method DrawToBitmap.
hope it helps
og-bit.com