8

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?

NLV
  • 21,141
  • 40
  • 118
  • 183
  • But does asp.net support WebBrowserControl? – NLV Mar 14 '11 at 09:31
  • You can look at this solution where you can find [a class that is responsible for making screenshot](http://stackoverflow.com/questions/5172478/taking-screenshot-of-aspx-page/5172606#5172606) – apros Mar 14 '11 at 10:32
  • A related q/a: [How to fix a opacity bug with DrawToBitmap on WebBrowser Control?](http://stackoverflow.com/q/21697048/1768303) – noseratio Feb 18 '14 at 08:11

4 Answers4

6

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

Community
  • 1
  • 1
Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
4

Check out webbrowser method

webBrowser1.DrawToBitmap(bitmap, bitmapRect);

for more complete example go here

Adrian Serafin
  • 7,665
  • 5
  • 46
  • 67
0

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

Fun Mun Pieng
  • 6,751
  • 3
  • 28
  • 30
0

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/

Anuraj
  • 18,859
  • 7
  • 53
  • 79
  • I load remote websites programmatically using WebRequest and WebResponse. So I only have the markup and I dont render it in the screen. – NLV Mar 14 '11 at 10:23