i have local file that contain some html with javascript and i want to capture it and save it as an image.
i tried to do it with WebBrowser:
WebBrowser browser = new WebBrowser();
browser.Navigate("C:\\charts\\pie.html");
HtmlDocument doc = browser.Document;
Bitmap bitmap = GenerateScreenshot(browser);
bitmap.Save("c:\\charts\\sample.png");
public static Bitmap GenerateScreenshot(WebBrowser wb)
{
wb.ScrollBarsEnabled = false;
wb.ScriptErrorsSuppressed = true;
Bitmap bitmap = new Bitmap(wb.Width, wb.Height);
wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
wb.Dispose();
return bitmap;
}
but i get every time blank image...
any idea??