Issue while converting website to image
<p>I am trying to convert webpage to image using thread ,see the code which i used</p>

<pre><code>public Bitmap Generate()
{
   var m_thread = new Thread(_Generate);
    //m_thread.IsBackground = true;
    m_thread.SetApartmentState(ApartmentState.STA);
    m_thread.Start();
    m_thread.Join();
    return m_Bitmap;
}

private void _Generate()
{
    var browser = new System.Windows.Forms.WebBrowser { ScrollBarsEnabled = false };
    browser.Navigate(m_Url);
    browser.DocumentCompleted += WebBrowser_DocumentCompleted;

    while (browser.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete)
    {
        System.Windows.Forms.Application.DoEvents();
    }

    browser.Dispose();
}
</code></pre>

<p>While debugging  browser.ReadyState does not comes to complete state,It comes to interactive state then ,it will exit from while loop and also hanging in m_thread.Join() .So that the document was not completed in webBrowser 
<img src="http://i.stack.imgur.com/kJySS.png" alt="enter image description here"></p>
