Problem in taking screenshot of webPages
Hello,
I want screenshot of website by passing url. I used the DrawtoBitmap method of webbrowser but it is not working properly. It gives empty images. I want screenshot of websites which i passed in loop.
Code ::
arrayList arrURL;
bool flagSC = true;
for(int i=0l i< url.length;i++)
{
if (flagSC == true)
{
webbrowser1.navigate(arrURL[i].ToString());
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
}
else
{
i -= 1;
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
flagSC = false;
Bitmap bitmap = new Bitmap(webBrowser1.Bounds.Width, webBrowser1.Bounds.Height);
webBrowser1.DrawToBitmap(bitmap, webBrowser1.Bounds);
bitmap = (Bitmap)bitmap.GetThumbnailImage(175, 128, null, IntPtr.Zero);
bitmap.Save(filePath);
flagSC = true;
bitmap.Dispose();
}
}
The above code gives blank images.
Thanks in advance.