Tools to Capture and Convert the Web

Advanced Screenshot Features with ASP.NET

ASP.NET API

As well as the basic screenshot functionality the GrabzIt ASP.NET API allows developers to check the status of existing screenshots and set the cookies that GrabzIt will use to take screenshots for the developer.

Screenshot Status

Sometimes a application may need to check the status of a screenshot, perhaps to see if it has been taken or to check if it is still cached.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

ScreenShotStatus status = grabzIt.GetStatus(screenShotId);

if (status.Processing)
{
    // screenshot has not yet been processed
}

if (status.Cached)
{
    // screenshot is still cached by GrabzIt
}

if (status.Expired)
{
    // screenshot is no longer on GrabzIt
    // Perhaps output status message?
    label.Text = status.Message;
}

Cookies

Some websites control functionality through cookies. GrabzIt allows you to set your own developer definied cookies in the following way.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

// gets an array of cookies for google.com
GrabzItCookie[] cookies = grabzIt.Cookies("google.com");

# sets a cookie for the google.com domain
grabzIt.SetCookie("MyCookie", "google.com", "Any Value You Like");

# deletes the previously set cookie
grabzIt.DeleteCookie("MyCookie", "google.com");

Note that the delete cookie method will delete all cookies with the same name and domain.

Display a Capture without Downloading

While its recommended that a capture is downloaded to a web server before being used. It is possible to display any type of capture in a user's browser without downloading it onto your web server first.

Once the capture has completed you can send the bytes of the capture returned by the SaveTo method to the response along with the correct mime type.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

grabzIt.URLToImage("https://www.tesla.com");
GrabzItFile capture = grabzIt.SaveTo();

if (capture != null)
{
    Response.ContentType = "image/jpeg";
    Response.BinaryWrite(capture.Bytes);
}

An example of outputting a capture to the response is shown above for the URLToImage method, but it will work with any of the conversion methods.