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
Chrome Headless

Converting Web Pages into Images and PDFs: Chrome Headless and Playwright

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

To save a rendered web page as an image, use Chrome Headless with --screenshot or Playwright’s page.screenshot(). To create a PDF, use --print-to-pdf or Playwright’s page.pdf(). Choose an image when you need a visual snapshot at a defined viewport; choose a PDF when you need a printable, paginated document. Playwright gives finer control over automation and PDF layout, while Chrome’s command line is quickest for one-off captures.

Choose the output before you capture

Need Best route Important behavior
One quick PNG screenshot Chrome Headless CLI Minimal setup; set the viewport with --window-size.
One quick PDF Chrome Headless CLI Use --print-to-pdf; add --no-pdf-header-footer for a cleaner file.
Repeated or conditional captures Playwright Page API Automation code can wait for selectors, reuse buffers and control rendering.
PDF matching on-screen styling Playwright Call page.emulateMedia({ media: 'screen' }) before page.pdf(); PDFs otherwise use print media.

A screenshot is a raster image of a viewport (or a full page when supported by the API). A PDF is a paginated document whose line breaks, colors and visibility can change under print CSS. Neither format automatically proves that every asynchronous element finished loading.

Save a web page as an image with Chrome Headless

Chrome’s documented headless command-line options are suitable for a shell script, CI job or a single capture. The following command saves screenshot.png in the current directory:

chrome --headless --screenshot --window-size=412,892 https://developer.chrome.com/

--window-size=412,892 sets the viewport dimensions in CSS pixels. Change those numbers for the layout you need. The resulting image reflects what fits in that viewport; it is not a PDF and does not preserve selectable text.

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.
#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)

Capture a full-page image

Chrome’s command-line reference documents the basic screenshot flag but does not make a universal full-page guarantee for every version or invocation. If content below the viewport matters, use Playwright’s fullPage option or inspect the generated image rather than assuming the CLI captured the entire document.

Account for slow or dynamic pages

Use a maximum wait when a page can take a long time:

chrome --headless --screenshot --timeout=15000 https://example.com/

The timeout is only an upper limit before capture. It does not mean that a site’s API calls, lazy images or client-side rendering have completed. Check the output and prefer an application-level readiness condition when accuracy matters.

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

Save a web page as a PDF with Chrome Headless

This command writes output.pdf:

chrome --headless --print-to-pdf https://developer.chrome.com/

To omit the printed URL, date and page details, add the documented flag:

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 --print-to-pdf --no-pdf-header-footer https://developer.chrome.com/

Older Chrome releases may use a previous name for the header/footer option, so check the Chrome Headless command-line reference for the version installed on your machine. PDF pagination and styling still depend on the page’s print rules.

Automate screenshots with Playwright

Playwright is the better fit when capture is part of a repeatable test, documentation build or content pipeline. Its Page API can save directly to a path:

Rank #3
Sale
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.
import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });
await browser.close();

page.screenshot() supports options such as a path, full-page capture, clipping and image format. Waiting for networkidle can help, but it is not a promise that a page’s own background jobs or lazy content are complete. For a stronger condition, wait for a selector that signifies the content you need:

await page.goto('https://example.com');
await page.locator('[data-ready="true"]').waitFor();
await page.screenshot({ path: 'ready.png' });

Consult the Playwright Page API reference for the current option names supported by your installed version.

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

Generate a PDF with Playwright

page.pdf() returns a PDF buffer and can save to a path. This example sets paper format, margins and background graphics:

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
import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.pdf({
  path: 'page.pdf',
  format: 'A4',
  margin: { top: '16mm', right: '14mm', bottom: '16mm', left: '14mm' },
  printBackground: true
});
await browser.close();

Keep screen styling instead of print styling

Playwright PDF generation uses print CSS media by default. If the PDF should resemble the screen rendering, emulate screen media first:

await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'screen-style.pdf', printBackground: true });

Useful PDF controls

  • Format or dimensions: choose a paper format or explicit width and height.
  • Margins: reserve space for printers, binding or annotations.
  • Scale: shrink or enlarge page content when the source layout requires it.
  • Background graphics: enable printBackground when color blocks or images are part of the design.
  • Page ranges: export selected pages from a longer document.
  • CSS page size: honor the document’s declared page dimensions when appropriate.
  • Tagged output: Playwright documents a tagged option introduced in version 1.42, defaulting to false. Treat it as a generation option, not proof that the resulting PDF is accessible without additional testing.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make captures reliable

Wait for the content you actually need

Prefer a known selector, a page state marker or an explicit application event over an arbitrary sleep. Lazy-loaded images may require scrolling or a full-page screenshot to enter the viewport. Inspect the output for missing fonts, images and late-rendered components.

Control the rendering context

Set the viewport for responsive layouts. In Playwright, configure device scale or a device preset when pixel density matters. For PDFs, decide explicitly between print and screen media, then set paper, margins and background behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP LaserJet M110w Wireless Black & White Printer, Print, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
  • 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

Keep browser versions aligned

Command-line flags and Playwright options can change between releases. Record the Chrome and Playwright versions used by your automation and recheck the relevant documentation after upgrades.

Chrome Headless or Playwright?

  • Choose Chrome Headless for a fast, dependency-light command in a terminal or scheduled job.
  • Choose Playwright when you need selectors, conditional waits, repeated pages, reusable buffers, device contexts or detailed PDF options.
  • Use both when a simple operational path handles most captures and a scripted path handles exceptions.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. It accepts a URL and returns a PNG, JPEG, WebP or PDF, while handling common capture cleanup before rendering. Cookie and consent banners, newsletter popups and chat widgets are removed; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers.

Make one request (see the ScreenshotNeo documentation):

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

You can also use Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Or Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes full-page and element captures, device presets, retina scale, PDF paper and page-range controls, custom CSS and JavaScript, click and wait actions, request blocking, headers and cookies, geolocation and timezone, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

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

The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is available on every plan. Create a free ScreenshotNeo account.

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.

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.