October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Test a Website’s Print Stylesheet with Browser Screenshots

Emulate print media in Playwright, capture the styled page, and add a PDF check when pagination matters.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

To test print CSS with a browser screenshot, load the page in Playwright, switch its media type to print, then capture the rendered page. Use a full-page screenshot to review print-specific styling and visual changes; generate a PDF as well if you need to check paper size, margins, and page breaks. A screenshot shows the print-media rendering, but does not prove that every print dialog or physical printer will produce the same result.

What a print stylesheet test should cover

Print styles apply when the browser uses the CSS print media type. They can be defined in an @media print block or in a stylesheet linked with media="print". See MDN’s CSS printing guide.

As an Amazon Associate I earn from qualifying purchases.

Decide which states and content matter before you capture. For example, check the normal screen state separately from the print state, and include long articles, tables, images, forms, or sections with page-break rules if the page contains them. Fix the application state and ensure the fonts, images, and asynchronous content needed for printing have loaded.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Are navigation, interactive controls, and other screen-only elements hidden?
  • Does print-only material appear where expected?
  • Are text, images, tables, and columns readable and appropriately sized?
  • Do headings stay with useful content, and are links or references understandable on paper?
  • If pagination matters, are paper size, margins, and page breaks acceptable in the PDF?

These are review checks, not conditions that a screenshot automatically validates.

#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Test print CSS and capture a screenshot with Playwright

Install Playwright and a browser supported by your project. The following example uses Node.js and Chromium. Save it as print-check.mjs, then run it with node print-check.mjs. If you use another browser engine, install and launch that browser instead; rendering can differ between engines.

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });

try {
  await page.goto('https://example.com/article', { waitUntil: 'networkidle' });
  await page.evaluate(() => document.fonts.ready);
  await page.emulateMedia({ media: 'print' });
  await page.screenshot({ path: 'article-print.png', fullPage: true });
} finally {
  await browser.close();
}

Replace the example URL with the page under test. The key operation is page.emulateMedia({ media: 'print' }), which activates print-media rules before the screenshot. In this state, matchMedia('print') is true and matchMedia('screen') is false. See the Playwright Page API.

fullPage: true captures beyond the current viewport, which is useful for inspecting a long document as one image. It does not create paper pages: use PDF output to inspect paginated rendering.

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

Capture screen and print states separately

If your test needs both states, take the screen screenshot before enabling print media, then capture the print screenshot. Alternatively, use a separate page or context. Restore the default media state after the print capture if you continue using the same page:

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
await page.emulateMedia({ media: 'screen' });

Keep the viewport and device scale factor consistent between screenshot runs. Record them with the test so visual changes are not confused with environment changes.

Make screenshots stable enough to compare

Wait for the content that matters, rather than relying on the same short delay for every site. networkidle is one navigation option, but it may not be suitable for pages with ongoing network activity. If content loads asynchronously, wait for a relevant selector or for the application to signal readiness. Disable or mask changing content such as timestamps, rotating banners, or live counters when those differences are irrelevant.

For Playwright Test visual regression checks, toHaveScreenshot() waits for two consecutive screenshots to stabilize before comparing against an expectation. Its options include animation handling, screenshot scale, masks, and pixel-difference tolerances. This assertion belongs to the Playwright Test runner; it is not a method on a plain Playwright Page. See the Playwright PageAssertions API.

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

Generate a PDF to check pagination

A print-media screenshot is an image of the page’s print styling; it does not exercise paper-page geometry. To inspect pagination, create a PDF alongside the screenshot. Playwright states in its Page API documentation that page.pdf() generates a PDF using print CSS.

await page.pdf({
  path: 'article-print.pdf',
  format: 'A4',
  printBackground: true
});

Call page.pdf() after emulating print media if you want the screenshot and PDF to use the same print state. The method supports paper format or dimensions, margins, page ranges, landscape output, and CSS page-size preferences. By default, PDF background printing is off; set printBackground: true when backgrounds are part of what you need to review. With preferCSSPageSize: true, a CSS @page size takes priority over PDF width, height, or format settings. Browser print color adjustments can affect colors; Playwright documents -webkit-print-color-adjust as a way to force exact color rendering. Check the API documentation for the options and defaults applicable to your installed Playwright version.

Rank #3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Inspect the resulting pages for clipped content, awkward breaks, unexpected blank pages, and how tables, images, and headings flow. A screenshot alone cannot establish that page breaks or print settings are correct.

Use Chrome Headless for a quick capture

For a command-line check without opening a visible browser window, Chrome documents these headless commands:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chrome --headless --screenshot --window-size=412,892 https://example.com/
chrome --headless --print-to-pdf https://example.com/

The screenshot command captures an image; the PDF command is the more useful route for inspecting print output and pagination. Chrome’s --timeout option sets the maximum wait before capture when a page may still be loading. Pick a timing strategy that suits the page, and verify that fonts and asynchronous content have actually appeared. Chrome notes that the flag name for suppressing PDF headers and footers changed, so check the Chrome Headless command-line reference against the version installed on the machine running the command. That documentation was last updated 2024-10-21 UTC.

Keep the test reproducible

Save the browser and rendering details beside the screenshot or PDF. Useful details include:

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
  • Browser engine and version, and operating system or CI image when relevant.
  • Page URL and application state.
  • Screenshot viewport and device scale factor.
  • For PDFs, paper format or dimensions, margins, page range, orientation, background setting, and whether CSS page size takes priority.
  • How fonts and asynchronous content were allowed to load, and any timing controls or masked elements.

Keep comparison baselines tied to the same environment. Review visual changes intentionally after browser upgrades. Playwright supports Chromium, Firefox, and WebKit projects, but the documentation does not establish that one engine’s output will match another’s native print pipeline.

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

Common problems and fixes

The screenshot still looks like the screen version

Confirm that page.emulateMedia({ media: 'print' }) ran before page.screenshot() and that the site’s rules target the print media type. Check whether print rules are in an @media print block or a linked stylesheet with media="print".

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

Fonts or images are missing

The capture may have started before those resources finished loading. Wait for the specific content or asset needed by the test, and verify that the page can load it in the test environment. Do not assume a fixed delay is sufficient for every page.

The PDF differs from the screenshot

The screenshot is one rendered image; the PDF paginates content and applies paper dimensions and margins. Check the PDF settings and any CSS @page rules. Include PDF review when page geometry is part of the requirement.

Best Value
HP LaserJet M110w | Monochrome | Laser Printer
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more

Visual regression tests fail intermittently

Make the page state repeatable and handle dynamic regions that are not part of the intended comparison. With Playwright Test, use toHaveScreenshot() and its stabilization and masking options rather than comparing captures taken at arbitrary times.

Headless Chrome captures incomplete content

Asynchronous pages may need more time or a different readiness condition. Use the documented --timeout option where appropriate, then verify that the required content was loaded. Check the installed Chrome version’s command-line documentation for compatible PDF header and footer flags.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. A one-request capture can save an image of a URL:

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

See the ScreenshotNeo documentation for request options. A screenshot service call is not a substitute for Playwright’s print-media emulation or a PDF when you specifically need to test print CSS and page breaks; use the browser workflow above for those checks.

  • ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Responses identify the page verdict and billing status in headers.
  • Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Quick Recap

Bestseller No. 3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
FAST PRINT SPEEDS: Print up to 19 pages per minute.; PAPER CAPACITY: Up to 150 sheets.; SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
$134.99
Bestseller No. 5
HP LaserJet M110w | Monochrome | Laser Printer
HP LaserJet M110w | Monochrome | Laser Printer
WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere; FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.