NLV
NLV

Reputation: 21657

Taking screen shot of a (remote) web page programmatically

I'm trying to take screen shots of web pages programmatically. I may also require to take screen shots of full or partial page. Is there a way to do this?

Upvotes: 8

Views: 3392

Answers (4)

Anuraj
Anuraj

Reputation: 19618

Try this

Rectangle region = new Rectangle(0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);
using (Bitmap bitmap = new Bitmap(region.Width, region.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
using (Graphics bitmapGraphics = Graphics.FromImage(bitmap))
{
bitmapGraphics.CopyFromScreen(region.Left, region.Top, 0, 0, region.Size);
bitmap.Save("location");
}

Source : http://www.dotnetthoughts.net/2007/04/13/capture-screen-using-c-and-net-20/

Upvotes: 0

Jon Egerton
Jon Egerton

Reputation: 41589

This question seems to cover capturing web pages - including alternatives to WebBrowser.DrawToBitmap. I guess once you've got the full page as an image you can manipulate that to get the partial page shot

Upvotes: 6

Adrian Serafin
Adrian Serafin

Reputation: 7725

Check out webbrowser method

webBrowser1.DrawToBitmap(bitmap, bitmapRect);

for more complete example go here

Upvotes: 4

Fun Mun Pieng
Fun Mun Pieng

Reputation: 6911

you could use a WebBrowser control, and use the VB PrintForm control to capture the output.

Upvotes: 0

Related Questions