.NET SDK
Official SDK for the ScreenshotCenter API. Capture screenshots, PDFs, HTML, and video — without writing raw HTTP calls.
Installation
terminal
dotnet add package ScreenshotCenter
Package coming soon to NuGet — nuget.org/packages/ScreenshotCenter
Quick start
Program.cs
using ScreenshotCenter;
var client = new ScreenshotCenterClient(
Environment.GetEnvironmentVariable("SCREENSHOTCENTER_API_KEY")!);
var shot = await client.Screenshot.CreateAsync("https://example.com");
var result = await client.WaitForAsync(shot.Id);
Console.WriteLine(result.Status); // "finished" More examples
Geo-targeting
var shot = await client.Screenshot.CreateAsync("https://example.com",
new Dictionary<string, string> {
["country"] = "fr",
["lang"] = "fr-FR"
});
var done = await client.WaitForAsync(shot.Id);
await client.Screenshot.SaveImageAsync(done.Id, "/tmp/fr.png"); PDF generation
var shot = await client.Screenshot.CreateAsync("https://example.com",
new Dictionary<string, string> { ["pdf"] = "true" });
var done = await client.WaitForAsync(shot.Id);
await client.Screenshot.SavePdfAsync(done.Id, "/tmp/page.pdf"); Error handling
try
{
var result = await client.WaitForAsync(shot.Id, timeoutMs: 60_000);
}
catch (ScreenshotFailedException e)
{
Console.Error.WriteLine($"Failed: {e.Reason}");
}
catch (TimeoutException e)
{
Console.Error.WriteLine($"Timed out after {e.TimeoutMs}ms");
}
catch (ApiException e)
{
Console.Error.WriteLine($"API error {e.Status}: {e.Message}");
}