ScreenshotCenter 1.0.2

dotnet add package ScreenshotCenter --version 1.0.2
                    
NuGet\Install-Package ScreenshotCenter -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ScreenshotCenter" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ScreenshotCenter" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="ScreenshotCenter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ScreenshotCenter --version 1.0.2
                    
#r "nuget: ScreenshotCenter, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ScreenshotCenter@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ScreenshotCenter&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=ScreenshotCenter&version=1.0.2
                    
Install as a Cake Tool

ScreenshotCenter .NET SDK

Official C# / .NET SDK for the ScreenshotCenter API.

Requirements

  • .NET 6.0 or later

Installation

dotnet add package ScreenshotCenter

Quick start

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"

Use cases

Geo-targeting

var shot = await client.Screenshot.CreateAsync("https://example.com",
    new Dictionary<string, string> { ["country"] = "fr", ["lang"] = "fr-FR" });

PDF

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");

Multiple shots

var shot = await client.Screenshot.CreateAsync("https://example.com",
    new Dictionary<string, string> { ["shots"] = "5" });
var done = await client.WaitForAsync(shot.Id);
await client.Screenshot.SaveImageAsync(done.Id, "/tmp/shot3.png",
    new Dictionary<string, string> { ["shot"] = "3" });

Batch

// Requires batch worker service to be running
var batch  = await client.Batch.CreateAsync(
    new[] { "https://example.com", "https://example.org" }, "us");
var result = await client.Batch.WaitForAsync(batch.Id, intervalMs: 3000, timeoutMs: 120_000);
await client.Batch.SaveZipAsync(result.Id, "/tmp/batch.zip");

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}");
}

API reference

ScreenshotCenterClient(apiKey, baseUrl?, httpClient?)

Parameter Default Description
apiKey Required
baseUrl production Override API base URL
httpClient built-in Injectable HttpClient for testing

client.Screenshot

Method Description
CreateAsync(url, parameters?) Create a screenshot
InfoAsync(id) Get screenshot metadata
ListAsync(parameters?) List screenshots
SearchAsync(url, parameters?) Search by URL
ThumbnailAsync(id, parameters?) Raw image bytes
HtmlAsync(id) Raw HTML bytes
PdfAsync(id) Raw PDF bytes
VideoAsync(id) Raw video bytes
DeleteAsync(id, data?) Delete a screenshot
SaveImageAsync(id, path, parameters?) Save image to disk
SaveHtmlAsync(id, path) Save HTML to disk
SavePdfAsync(id, path) Save PDF to disk
SaveVideoAsync(id, path) Save video to disk

client.Batch

Method Description
CreateAsync(urls, country, parameters?) Create a batch
CreateFromStringAsync(content, country, parameters?) Create from newline-separated string
InfoAsync(id) Get batch status
ListAsync(parameters?) List batches
DownloadAsync(id) Download ZIP bytes
SaveZipAsync(id, path) Save ZIP to disk
WaitForAsync(id, intervalMs?, timeoutMs?) Poll until done

client.Account

Method Description
InfoAsync() Get account info (balance, plan)

client.WaitForAsync(id, intervalMs?, timeoutMs?)

Poll a screenshot until finished or error.

Testing

Environment variables

Variable Description
SCREENSHOTCENTER_API_KEY Required for integration tests
SCREENSHOTCENTER_BASE_URL Override base URL (default: production)

Running tests

# Unit tests only (default)
dotnet test

# Integration tests against a local instance
SCREENSHOTCENTER_API_KEY=your_key \
SCREENSHOTCENTER_BASE_URL=http://localhost:3000/api/v1 \
dotnet test --filter "Category=Integration"

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 85 3/15/2026
1.0.1 82 3/15/2026
1.0.0 82 3/15/2026