Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an HTML page that uses CSS, JavaScript, web fonts, or responsive layout, render it in a real browser and save a screenshot. In .NET, Playwright’s Page.ScreenshotAsync is the most direct route: it can save a viewport or full-page image, return image bytes, and capture a single element. Selenium is a practical alternative when your project already runs WebDriver tests, though full-page capture depends more on the browser and driver.

Choose a browser renderer for modern HTML

An HTML document is not necessarily a finished image. Its appearance may depend on CSS layout, JavaScript execution, downloaded fonts, viewport dimensions, and assets that load after navigation. A browser automation library evaluates those parts together; a simple HTML-to-image conversion that does not run the page’s browser code may produce an incomplete or different result.

For a new .NET screenshot workflow, Playwright gives you viewport, full-page, and element captures through one API, with PNG, JPEG, and WebP output documented by its Page API. If your test suite already relies on Selenium WebDriver, using its screenshot interface may fit better than introducing another browser stack. See the Playwright .NET screenshot guide and Selenium ITakesScreenshot API.

Convert an HTML page to PNG with Playwright for .NET

Install the package and browser

Add Playwright to your .NET project:

dotnet add package Microsoft.Playwright

After building a project that references the package, install the browser binaries using Playwright’s install script. For example, on a typical .NET project, run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Liene M100 4x6'' Photo Printer, Phone Printer 100 Sheets & 3 Cartridges, Full-Color Photo, Portable Instant Photo Printer for iPhone Android, Thermal Dye Sublimation, Wi-Fi Picture Printer 100 Papers
  • User-Friendly Portable Photo Printer for iPhone, Android & PC - Get beautiful and colourful memories with Liene 4x6 photo printer! After opening the entire package, you can find one cartridge + 20 sheets of photo paper (placed inside the machine packaging), as well as an additional box containing 80 sheets of photo paper (which includes two cartridges + 80 sheets of photo paper). Full package includes smartphone photo printer, Liene 4x6 photo printer papers (100 sheets), 3 colour cartridges, and fully sealed cassette to prevent dust. Minimalist and magnetic design for compact storage.
  • Superior Quality 4x6 Photo Printer - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Clean the print head promptly if smudges are observed on printed photos during operation. Get Liene photo printers now for yourself and your loved ones, print your happy moments together and keep your love forever!
  • Wi-Fi Photo Printer for Smartphone - The built-in hotspot of the photo printer makes it easy to print pictures from your phone, avoiding outside interference with a fast and stable connection. No other networks required! Simply connect your device to the independent instant photo printer 4x6 hotspot.
  • Multiple Device Compatibility - Liene phone printer provides instant photo printing for up to 5 simultaneous connections. Share with family and friends or print from your different devices. No additional cables or Bluetooth required when printing photos with this picture printer. Note: Ensure the ink cartridge clicks into place before printing.
  • Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Square border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this photo printer for iphone 4x6 prints.
dotnet build
pwsh bin/Debug/netX.Y/playwright.ps1 install chromium

Replace netX.Y with your project’s target framework output directory, such as net8.0. Playwright’s browser installation instructions vary by operating system and package setup; use the official browser installation guide for the exact command. Linux containers may also need system dependencies installed. Browser builds are separate from your NuGet package, so pin package and browser versions in CI and install the required fonts and OS libraries in the runtime image.

Runnable console example

This example navigates to a page, waits for network activity to settle, and saves the full scrollable page as a PNG:

using Microsoft.Playwright;

using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new() { Headless = true });
var page = await browser.NewPageAsync(new()
{
    ViewportSize = new() { Width = 1440, Height = 900 }
});

await page.GotoAsync("https://example.com", new()
{
    WaitUntil = WaitUntilState.NetworkIdle
});

await page.ScreenshotAsync(new()
{
    Path = "page.png",
    FullPage = true
});

await browser.CloseAsync();

Use your target URL in place of https://example.com. ViewportSize controls the browser’s CSS viewport, which can affect responsive breakpoints and the page layout. Omit FullPage = true to capture the visible viewport only. Playwright’s documented basic pattern uses Page.ScreenshotAsync; omitting Path returns image data as a byte[] instead of writing a file. See the official screenshot guide.

Choose the capture scope and image format

Viewport, full page, or one element

  • Viewport: Use await page.ScreenshotAsync(new() { Path = "viewport.png" }); when you need only what is visible at the current scroll position.
  • Full page: Set FullPage = true to capture the full scrollable page. A very long page can create a large image; check memory use and output dimensions for your target sites.
  • One element: Use a locator’s screenshot method to capture a component rather than the entire page: await page.Locator(".header").ScreenshotAsync(new() { Path = "header.png" });. Ensure the locator matches the intended element and is visible before capture.
  • A clipped rectangle: Set Clip on the screenshot options when you need a specific region of the viewport rather than a DOM element.

Return bytes instead of writing a file

To store, upload, or post-process the image in memory, omit Path and use the returned byte array:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
KODAK Dock Plus 4x6 Photo Printer, Smartphone Docking, 4PASS, 50 Sheets
  • Dock Photo Printer: The KODAK Dock Plus is a home photo printer that produces high-quality 4x6” prints directly from compatible smartphones. Featuring an integrated docking station, users can place their phone on the printer for better connection while simultaneously charging the device during printing.
  • Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
  • Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Dock Plus is built for straightforward operation, making it ideal for first time users and everyday photo printing.
  • Home Printing Station: Designed for stable desktop use, this dock photo printer connects to a power outlet for consistent performance and larger 4x6” prints. Ideal for home printing, photo albums, framing, family events, and everyday picture printing.
  • KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.
byte[] imageBytes = await page.ScreenshotAsync(new()
{
    FullPage = true
});

You can then pass imageBytes to your application’s storage or processing code. The screenshot API’s image bytes represent the selected output format; check the corresponding options and file handling when choosing a non-PNG format.

PNG, JPEG, and WebP

PNG is lossless and is a sensible default for text, interfaces, and screenshots where crisp edges matter. JPEG and WebP can reduce file size, with a quality setting available for lossy output. The Page API documents format-related options including Quality for JPEG and WebP, Scale for CSS-pixel or device-pixel output, and OmitBackground for a transparent background where supported. It also documents Mask for covering selected locators and Animations to control animation handling. Consult the Page screenshot API reference for option names and constraints. WebP screenshot support is version-sensitive, so confirm your installed Playwright release supports it in the release notes.

Make captures reliable for dynamic pages

Waiting for navigation is not the same as knowing the page is visually ready. The sample uses WaitUntilState.NetworkIdle, but network-idle is a workflow choice, not a universal readiness guarantee. Analytics, polling, animations, lazy-loaded images, and web fonts can make a page look unfinished even after a navigation wait has completed.

  1. Wait for a meaningful page condition. If the result depends on a particular panel or component, wait for that selector to appear before capturing. This is usually more relevant than an arbitrary long delay.
  2. Handle lazy content deliberately. Full-page capture does not prove every image that loads on scroll has been fetched. If lower-page images matter, scroll through the relevant content or wait for the application’s own loaded state before the screenshot.
  3. Bound waits and retries. The screenshot API documents a default timeout of 30,000 milliseconds. Set a timeout suited to your workflow and fail clearly when a page does not reach its expected state rather than waiting indefinitely.
  4. Control animation when visual consistency matters. Use the documented animation options, and make sure fonts and other assets have loaded before capture when they affect the pixels.

Playwright exposes screenshot and timeout controls, but no generic wait makes every site deterministic. Pin the browser revision, viewport, fonts, and relevant page state if you compare screenshots across CI runs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Nelko PP01 Photo Printer, 2x3 Portable Photo Printer, Mini Printer, White
  • 2x3" Portable Photo Printer: The upgraded PP01 photo printer uses advanced inkjet technology. This portable photo printer produces vivid, full-color prints on premium sticky-backed photo paper that is smudge-proof, water-resistant, and tear-resistant. The Nelko mini photo printer is pocket-sized and weighs only 308g, making it ultra-portable for school, travel, and field trips. Each ink cartridge prints up to 80 full-color 2x3 photos on sticky-backed paper
  • Easy Printing via Bluetooth: The PP01 mini photo printer is compatible with iOS and Android phones via Bluetooth. Simply download the Nelko app from Google Play or the App Store. Load the 2x3 photo paper with the smooth side facing down. Install the ink cartridge, connect via Bluetooth, and print directly using the Nelko app. A USB charging cable is included; the adapter is not included
  • High Photo Quality: This mini photo printer uses advanced inkjet technology for clear, vibrant prints. This portable photo printer produces 600 DPI high-resolution images with precise colors, capturing fine details and realistic tones. Each photo comes with adhesive backing, perfect for scrapbooks and preserving your memories. Personalize every photo for holidays, birthdays, or daily events
  • Powerful App: The Nelko 2x3" PP01 photo printer app lets you edit photos and offers a variety of frame designs, making it perfect for personalizing your photos for projects like scrapbooking or journaling. Download the Nelko app to create collages and customize photos with filters, graffiti, borders, stickers, text, AI image editing, and many other features. Edit photos on your phone, then send them to the Nelko app for instant printing in under 90 seconds
  • Versatile Usage Scenarios: This portable photo printer is ideal for travel journals, party favors, and family gatherings. Students use it for planners and photo printing. Crafters use it for DIY projects, custom labels, and scrapbooking. It's a practical tool for bloggers, small businesses, and event photographers to create instant giveaways. Perfect for Mother's Day surprises and heartfelt moments with loved ones using Nelko sticky-backed photo paper.

Use Selenium when WebDriver is already part of the project

Selenium can capture the currently loaded browser page through ITakesScreenshot.GetScreenshot() and save the resulting PNG. Navigate first, apply your project’s explicit waits, then capture:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

using var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://example.com");

// Add an explicit wait for the page state your application needs here.
var screenshot = ((ITakesScreenshot)driver).GetScreenshot();
screenshot.SaveAsFile("page.png");

driver.Quit();

The Selenium API describes the screenshot as an image of the page currently loaded in the browser and SaveAsFile as writing a PNG, overwriting an existing file. The basic screenshot is viewport-oriented. Full-document capture may require measuring rendered document dimensions and resizing the window, or using a browser-specific DevTools command. Behavior differs among drivers and browsers, so validate the exact combination used in CI; do not assume Selenium and Playwright produce pixel-identical results. See the Selenium Screenshot API.

Playwright or Selenium: which fits?

Need Playwright for .NET Selenium WebDriver
New browser screenshot workflow First-class page, full-page, element, byte-array, and screenshot option APIs in one .NET interface. Works, but most compelling when WebDriver is already part of the test infrastructure.
Full-page image Use the documented FullPage screenshot option. More driver- and browser-dependent; validate the approach you use.
Single element Capture a locator directly. Use available element screenshot support in your Selenium setup; verify behavior for the target driver.
Runtime setup Install compatible Playwright browser builds and Linux dependencies where needed; branded Chrome is not installed by default. Requires a compatible WebDriver/browser setup for the project’s chosen browser.

Playwright is generally the simpler starting point for a new .NET capture utility. Selenium is reasonable when reusing existing WebDriver fixtures and operational conventions matters more than having Playwright’s screenshot controls in the same API. Neither choice removes the need to control browser version, fonts, viewport, and page readiness.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Deploy in CI and troubleshoot common failures

Browser executable is missing

Cause: The .NET package is present, but its browser binaries were not installed in the environment running the app. Fix: Add Playwright’s browser installation step to the build or container setup, and install the needed Linux dependencies using the official browser documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Liene Amber M110 Bluetooth Photo Printer 80 Sheets, Portable Photo Printer for iPhone, Thermal Dye Sublimation, Picture Printer 60 Sheets 4x6 Paper & 20 Sheets 3" Square Sticker Paper & 2 Cartridges
  • Dual 4x6" & 3x3" Photo Printer Paper Tray Convenience: Seamlessly print both 6-inch standard photo paper and 3-inch sticky-backed paper with our innovative dual tray design. This compact phone photo printer for smartphone offers easy storage and quick access, making it perfect for diverse printing needs without taking up much space. Enjoy vibrant, high-quality prints every time.
  • Fast Bluetooth Connectivity: Experience lightning-fast printing with our liene photo printer's Bluetooth connection, which pairs in just 13 seconds. Enjoy a seamless and efficient printing experience, perfect for capturing and sharing memories on the go without the hassle of cables or complex setups.
  • Superior Quality Photo Printer 4x6 - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Get Liene photo printers now as amazing gifts for yourself and your loved ones, print your happy moments together and keep your love forever!
  • Multiple Device Compatibility - Liene picture printer for iphone provides instant photo printing for up to mutiple simultaneous connections. Share with family and friends or print from your different devices. No additional cables required when printing photos with this phone printer.
  • Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Polaroid border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this iphone photo printer for 4x6 & 3x3 prints.

Fonts or layout differ from a developer machine

Cause: The CI image has different fonts, browser builds, or viewport dimensions. Font substitution changes rendered text and can move other elements. Fix: Pin the Playwright package and browser revision, install the fonts your page needs, and set the viewport explicitly.

Screenshot is blank, incomplete, or missing lazy images

Cause: Navigation completed before the application rendered the target state, or below-the-fold content was not loaded. Fix: Wait for a relevant selector or application readiness condition; for lazy content, trigger the required scrolling/loading behavior before capturing.

Navigation or capture times out

Cause: The page is slow, long-lived network activity prevents the selected wait condition, or the screenshot itself exceeds the configured timeout. Fix: Prefer a meaningful readiness condition over relying on network idle for every site, set a bounded timeout appropriate to the workflow, and report whether navigation or screenshot capture failed.

Full-page capture is unexpectedly large or inconsistent

Cause: Long pages, responsive layout, dynamic content, and driver-specific full-page methods can change dimensions or content. Fix: Set viewport dimensions, decide whether a complete document or only a viewport is required, and validate full-page behavior on the browser and driver used in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
KODAK Mini 2 Retro 2x3 Portable Photo Printer, 4PASS, 38 Sheets, White
  • Instant Photo Printing: The KODAK Mini 2 Retro is a portable photo printer designed to turn smartphone pictures into high quality prints in seconds. Whether capturing family moments, travel highlights, journaling pages, or creative projects, this mini printer lets you print real photos anytime, anywhere.
  • Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
  • Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Mini 2 Retro is built for straightforward operation, making it ideal for first time users and everyday photo printing.
  • Print Anytime, Anywhere: Small enough to fit in your hand, bag, or even a pocket, the Mini 2 Retro is built for on-the-go printing. Ideal for parties, trips, school projects, scrapbooks, and spontaneous moments where you want real prints without waiting.
  • KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.

WebP option is unavailable

Cause: Screenshot format support depends on the installed Playwright version. Fix: Check the release notes for the Playwright release line you use and upgrade deliberately if the required format is supported there.

Or skip the browser setup

If you need a screenshot from code without managing browser binaries and capture logic, ScreenshotNeo accepts one GET request with a URL and returns a PNG, JPEG, WebP, or PDF. Its cookie/consent handling accepts the banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

Example cURL request (replace the key and target URL):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Create a free account for 1,000 screenshots a month, with no card required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can Playwright .NET save a screenshot directly to a byte array?

Yes. Call Page.ScreenshotAsync without setting Path; it returns a byte[].

Can I capture just one HTML element instead of the whole page?

Yes. Use a Playwright locator’s ScreenshotAsync method, such as page.Locator(".header").ScreenshotAsync(...).

Is a Playwright screenshot timeout always 30 seconds?

The Page screenshot API documents 30,000 milliseconds as its default. You can set a different timeout in screenshot options.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.