La prise de capture d'écran d'une page web par programmation

Comment prendre un sceenshot d'une page web par programme donnée à l'URL comme entrée?

Et voici ce que j'ai jusqu'à maintenant:

//The size of the browser window when we want to take the screenshot (and the size of the resulting bitmap)
Bitmap bitmap = new Bitmap(1024, 768);
Rectangle bitmapRect = new Rectangle(0, 0, 1024, 768);
//This is a method of the WebBrowser control, and the most important part
webBrowser1.DrawToBitmap(bitmap, bitmapRect);

//Generate a thumbnail of the screenshot (optional)
System.Drawing.Image origImage = bitmap;
System.Drawing.Image origThumbnail = new Bitmap(120, 90, origImage.PixelFormat);

Graphics oGraphic = Graphics.FromImage(origThumbnail);
oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
Rectangle oRectangle = new Rectangle(0, 0, 120, 90);
oGraphic.DrawImage(origImage, oRectangle);

//Save the file in PNG format
origThumbnail.Save(@"d:\Screenshot.png", ImageFormat.Png);
origImage.Dispose();

Mais ce n'est pas de travail. C'est seulement en me donnant un vide blanc de l'image. Ce qui me manque ici?

Est-il un autre moyen que je puisse obtenir la copie d'écran d'une page web par programmation?

Cette question a été simplement demandé hier, bien que principalement destiné à Perl. Peut-être que certaines de ses réponses, il pourrait vous aider, bien que serait évidemment de vous prendre une autre direction. Voici le lien.

OriginalL'auteur Manish | 2010-02-23