Website screenshots & PDFs in C# / .NET

No PuppeteerSharp download, no wkhtmltopdf wrapper and no PDF library license. One HttpClient call returns PNG or PDF bytes, from ASP.NET Core, a worker service or an Azure Function.

1. Get an API key

Click Get free key. You get 100 free renders instantly, no account needed. Store the key in an environment variable called SHOTMINT_KEY.

2. Screenshot a URL

var key = Environment.GetEnvironmentVariable("SHOTMINT_KEY");
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(90) };
http.DefaultRequestHeaders.Add("X-API-Key", key);

var target = Uri.EscapeDataString("https://example.com");
var res = await http.GetAsync($"https://shotmint.creasework.com/v1/screenshot?url={target}&full_page=true");
if (!res.IsSuccessStatusCode)
    throw new Exception($"Render failed ({(int)res.StatusCode}): {await res.Content.ReadAsStringAsync()}");

await File.WriteAllBytesAsync("shot.png", await res.Content.ReadAsByteArrayAsync());
Console.WriteLine($"Saved shot.png, credits left: {res.Headers.GetValues("X-Credits-Remaining").First()}");

Useful parameters: full_page=true for the whole scrollable page, width/height for the viewport, device_scale_factor=2 for retina, selector to capture a single element, dark_mode=true, and hide_selectors to remove cookie banners. See the full list.

3. Turn HTML into a PDF

using System.Text;
using System.Text.Json.Nodes;

// same HttpClient as above
var body = new JsonObject { ["html"] = "<h1>Invoice #42</h1>", ["format"] = "A4" }.ToJsonString();
var res = await http.PostAsync("https://shotmint.creasework.com/v1/pdf", new StringContent(body, Encoding.UTF8, "application/json"));
res.EnsureSuccessStatusCode();
await File.WriteAllBytesAsync("invoice.pdf", await res.Content.ReadAsByteArrayAsync());

// ASP.NET Core minimal API: stream it straight to the browser
// return Results.File(await res.Content.ReadAsStreamAsync(), "application/pdf", "invoice.pdf");

PDF options include format (A4, Letter…), landscape, margin, and print_background. You can pass a url instead of html.

Errors & credits

A failed render never costs a credit. Status 400 means bad input or an unreachable URL, 402 means you're out of credits, and 429/503 mean you should retry with backoff. Every successful response includes an X-Credits-Remaining header.

Notes for C# / .NET

Register one HttpClient (or use IHttpClientFactory) instead of creating one per request, and keep the timeout at 60 seconds or more for full-page captures. JsonObject escapes your HTML for you, so you can pass a Razor-rendered string as html, and unlike reflection-based serialization it also works in trimmed and Native AOT builds. The first example runs as-is as a .NET 10 file-based app (dotnet run shot.cs) or in any console project.

Try it with 100 free renders

No signup, no card. Get a key in one click, then buy credits only if you need more (from €5 for 2,000, never expire).

Get a free API key Full API reference