GrabzIt
Tools to Capture and Convert the Web

Take Website Screenshots with ASP.NETASP.NET API

The diagnostics panel can help you debug your code!

There are several ways that the GrabzIt API can be used to take screenshots and more in ASP.NET. To get started with the API follow these steps:

  1. Get your free Application Key and Secret.
  2. Download the free ASP.NET Demo and Library and try it out.
  3. Find out the basics about how GrabzIt's API works by reading the below overview.

ASP.NET API Overview

To use the API you will first need to create an instance of the GrabzItClient class, passing your application key and application secret from your GrabzIt account to the constructor. As shown in the below example, note that while all of our ASP.NET examples are written in C# any ASP.NET language will work with this library.

//Create the GrabzItClient class
//Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
private GrabzItClient grabzIt = GrabzItClient.Create("APPLICATION KEY", "APPLICATION SECRET");

Then use one of the SetImageOptions, SetPDFOptions, SetAnimationOptions or SetTableOptions methods to request that the GrabzIt service take a screenshot of the URL passed to it.

// To take a image screenshot
grabzIt.SetImageOptions("http://www.google.com"); 	
// Or to take a PDF screenshot
grabzIt.SetPDFOptions("http://www.google.com");
// Or to convert online videos into animated GIF's
grabzIt.SetAnimationOptions("http://www.google.com");
// Or to capture table(s)
grabzIt.SetTableOptions("http://www.google.com");

Then use one of the following save methods. Notice that we also include the URL to the handler, which will process the callback from the service and save the resulting screenshot. As this method requires a callback handler it is usually only possible to use this approach in a web application.

grabzIt.Save("http://www.example.com/handler.ashx"); 	

Alternatively the synchonous SaveTo method, this will force your application to wait while the screenshot is created so it should only be used were the Save method cannot be used, such as in a desktop application. Once the screenshot is created it is saved to the file path provided.

string filepath = "images/test.jpg";
grabzIt.SaveTo(filepath);

More Options

There are many more options including; configuring the browser height, browser width, screenshot height, screenshot width, the delay before a screenshot is taken and the image format of the screenshot. For all these options please see the Client documentation.

Try all our premium features for free with a 3 day free trial. Then from $5.99 a month, unless cancelled.
  • More Captures
  • More Features
  • More API's
  • Bigger Scrapes
  • Bigger Screenshots
  • Bigger Everything
Start Free Trial