how to create image from page html passing as string
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3012728/how-to-convert-aspx-html-page-to-image-format">How to convert *.aspx (HTML) page to Image format</a>  </p>
</blockquote>



<p>I am using this code to coonvert page html into image
but i am getting error in line</p>

<pre><code>(System.Drawing.Image img = System.Drawing.Image.FromStream(ms);)
</code></pre>

<p>Error is : <code>(Parameter is not valid.)</code></p>

<p>full code here:</p>

<pre><code>    string content = "";
    System.Net.WebRequest webRequest =
        WebRequest.Create("http://localhost:58534/EFTestApp/ScreenShot.aspx");
    System.Net.WebResponse webResponse = webRequest.GetResponse();
    System.IO.StreamReader sr = new StreamReader(
        webResponse.GetResponseStream(),
        System.Text.Encoding.GetEncoding("UTF-8"));
    content = sr.ReadToEnd().Trim();
    //save to file
    byte[] bytesToEncode = Encoding.UTF8.GetBytes(content);
    string encodedText = Convert.ToBase64String(bytesToEncode);

    byte[] b = Convert.FromBase64String(encodedText);
    using (System.IO.MemoryStream ms = new System.IO.MemoryStream(b, 0, b.Length))
    {
        System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
        img.Save(
            Server.MapPath("screenshot/myscreenshot.bmp"),
            System.Drawing.Imaging.ImageFormat.Jpeg);
    }
</code></pre>
