How to take website screenshots with C# (.NET)

Posted March 24, 2023 by Dmytro Krasun ‐ 3 min read

Today, there are many options to make screenshots of any URL with C# (.NET). Let's examine them all and choose which suits you best.

Let’s check out:

  1. Puppeteer Sharp client for C# (.NET).
  2. Or Screenshot API as a service.

They might overlap, but there is no best solution. Each depends on your use case and requirements.

Puppeteer Sharp client for C# (.NET)

To take screenshots of any URL in the modern version of C#, you can use a headless browser library like PuppeteerSharp. Puppeteer Sharp is a .NET port of the popular JavaScript library Puppeteer, which controls headless Chromium or Chrome browsers.

In your .NET project, add the Puppeteer Sharp package using the NuGet Package Manager, or run the following command in the Package Manager Console:

Install-Package PuppeteerSharp

Create a new C# file and add the following code, replacing with the URL you want to take a screenshot of, and “screenshot.png” with the desired output file name.

using System;
using System.Threading.Tasks;
using PuppeteerSharp;

namespace ScreenshotExample
    class Program
        static async Task Main(string[] args)
            // Download the Chromium browser if needed
            await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);

            // Launch the browser
            using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
                Headless = true

            // Create a new page
            using var page = await browser.NewPageAsync();

            // Navigate to the URL
            await page.GoToAsync("");

            // Set the viewport size if needed (optional)
            await page.SetViewportAsync(new ViewPortOptions
                Width = 1920,
                Height = 1080

            // Take the screenshot
            await page.ScreenshotAsync("screenshot.png");

            // Close the browser
            await browser.CloseAsync();

            Console.WriteLine("Screenshot saved!");

Execute the program, and it will take a screenshot of the specified URL and save it as an image file in the project’s output directory. Remember to replace the URL and output file name with the desired values.

If you just want to take one or two screenshots locally, the PuppeteerSharp client is not the best fit. But if you plan to take millions of screenshots and manage browser instances, you can do it yourself, but it is better to outsource to well-established services.

Screenshot API as a service

ScreenshotOne specializes in taking screenshots and managing browser instances at scale. The service provides a high-quality C# (.NET) client to take screenshots and cover a variety of use cases.

It is easy to install. You can add the library via nuget using the package manager console:

PM> Install-Package ScreenshotOne.dotnetsdk

Or from the .NET CLI as:

dotnet add package ScreenshotOne.dotnetsdk

Don’t forget to sign up to get access and secret keys.

Generate a screenshot URL without executing request:

var client = new Client("<access key>', '<secret key>");	
var options = TakeOptions.Url("")
var url = client.GenerateTakeUrl(options);

// url =	

Take a screenshot and save the image in the file:

var client = new Client("<access key>', '<secret key>");	
var options = TakeOptions.Url("")
var bytes = await client.Take(options);

File.WriteAllBytes(@"c:\temp\example.png", bytes);	

If you feel that it is the best fit for you, feel free to sign up for our screenshot API and get the access key.


Pick the solution which suits your needs best. If you decide to go with our API, please ask any questions and mail us at And have a nice day 👋

By the way, you might also find interesting how to: