views:

1230

answers:

6

I want to be able to create a screen shot of a given Web site, but the Web site may be larger than can be viewed on the screen. Is there a way I can do this?

Goal is to do this with .NET in C# in a WinForms application.

+4  A: 

There are a few tools.

The thing is, you need to render it in some given program, and take a snapshot of it. I don't know about .NET but here are some tools to look at.

Ólafur Waage
A: 

Doing at as a screen shot is likely to get ugly. It's easy enough to capture the entire content of the page with wget, but the image means capturing the rendering.

Here's some tools that purport to do it.

Charlie Martin
A: 

I just found out about the website browsershots.org which generates screenshots for a whole bunch of different browsers. To a certain degree you can even specify the resolution.

Roalt
+1  A: 

I wrote a program in VB.NET that did what you specified, except for the screen size issue.

I embedded a web control(look at the very bottom of all controls) onto my form, and tweaked it's settings(Hide scroll). I used a timer to wait on dynamic content, and then I used "copyFromScreen" to get the image.

My program had dynamic dimensions(settable via command line). I found that if I made my program larger than the screen, the image would just return black pixels for the off screen area. I did not research farther since my job was complete at that time.

Hope that gives you a good start. Sorry for any wrong wordings. I log onto windows to develop only once every couple of months.

J.J.
+1  A: 

This is the code for creating screenshot programatically...

using System.Drawing.Imaging;

int screenWidth = Screen.GetBounds(new Point(0, 0)).Width; int screenHeight = Screen.GetBounds(new Point(0, 0)).Height; Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight); Graphics gfx = Graphics.FromImage((Image)bmpScreenShot); gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight)); bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);

jalpesh
A: 

You can render it on WebBrowser control and then take snapshot if page size bigger than screen size you have to scroll control take one or more snapshots and then merge all pictures :)

alex