Asp-netASP.net BackEnd Programming C#(cSharp) 

How to Capture Screenshot of a website Using ASP.Net

To Take a Screenshot of a website first you have to Create a Account in  Grabz.It and they will Provide you API keys to integrate it in your application.

Then 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.

//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 URLpassed to it.

// To take a image screenshot
grabzIt.SetImageOptions("http://www.getcodify.com"); 	
// Or to take a PDF screenshot
grabzIt.SetPDFOptions("http://www.getcodify.com");
// Or to convert online videos into animated GIF's
grabzIt.SetAnimationOptions("http://www.getcodify.com");
// Or to capture table(s)
grabzIt.SetTableOptions("http://www.getcodify.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 synchronous Save To 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);


Download Here

Also Read:  Getting Started With NodeJS

Related posts