Server-Side Screenshot Library

A small .NET (C# 3.0) library which programmatically uses Internet Explorer to create screenshots of web sites on the servers-side. This library is fully multi-threaded and can create numerous screenshots in parallel. Keep in mind that IE is a huge memory hog, which in my sample code required me to manually trigger the garbage collector fairly often. Also make sure to check out the following blog post on the topic. Download the ZIP file here.

Here is some sample code illustrating the use of this library:

// DateTime now = DateTime.Now;
// run with 3 threads
var builder = new Engine(3);
// start engine

// create 100 screenshots
Console.WriteLine("Submitting 100 requests.");
for (int i = 0; i < 100; i++)
    builder.CreateScreenshot("", string.Format(@"c:\temp\shot{0}.jpg", i), DateTime.MaxValue);

// keep the main thread alive
while (builder.QueueSize > 0)
    Console.WriteLine("Main thread waiting. Queue size: " + builder.QueueSize);

    // this is evil, but IE is a huge memory hog and I have found the system to quickly run out of memory if not doing
    // a GC every second under load.

// shuts down the threads and exists.