Capture screenshot of a webpage and get Image (ASP.NET)

Pabuc picture Pabuc · Sep 9, 2011 · Viewed 17.4k times · Source

I'm doing complex html operations on images (drag & drop) and when I'm done, I need to take the screenshot of the page and get the taken image save it on server (virtual dir).

So what I need is

Image img = CaptureURL("www.a.com/b.aspx");

Does anyone know of a library that could help me do this?

Thank you

Answer

Aristos picture Aristos · Sep 9, 2011

One solution is to use the WebBrowser control and render the result on a bitmap.

Here is the full solution, I think is simple and fast.

http://pietschsoft.com/post/2008/07/c-generate-webpage-thumbmail-screenshot-image.aspx

Other way is to use the IECapt that is a capture utility that can run on server and you can call it from your pages using the Process.Start.

here is the second solution.

http://codegod.org/WebAppCodeGod/Screenshot-of-Webpage-with-ASP-NET-AID398.aspx

And there is the javascript way, that your user render the page on the client side and send you the image. See some examples here : http://hertzen.com/experiments/jsfeedback/ and the source code is here: http://html2canvas.hertzen.com/

Hope this help