Use Playwright’s page.screenshot() when you need an image of a page or element; use page.pdf() when you need a paginated PDF for printing or document-style sharing. A full-page screenshot is one tall image, not a PDF with paper-sized pages. The other key difference is that PDF generation uses print CSS by default.
Choose by the deliverable
| Your need | Use | Why |
|---|---|---|
| Capture what is visible in the current browser viewport | page.screenshot() |
Its default output is a viewport image. |
| Capture one element or a selected region | page.screenshot() |
Screenshot options support element capture and clipping. |
| Save the entire scrollable page as one image | page.screenshot({ fullPage: true }) |
It captures the full scrollable page rather than only the visible viewport. |
| Create a printable or paginated document | page.pdf() |
It produces a PDF and exposes paper, margin, page-range, and print settings. |
| Make a PDF using screen styles rather than print styles | page.pdf() after page.emulateMedia({ media: 'screen' }) |
PDF generation uses print media by default; emulate screen media first when that is the intended layout. |
| Preserve exact print colors | page.pdf() with print CSS adjustments |
PDF colors are adjusted for printing by default; print CSS can request exact colors. |
These behaviors and options are documented in the Playwright Page API and the Playwright Screenshots guide.
As an Amazon Associate I earn from qualifying purchases.
What each method produces
Screenshots produce image buffers
page.screenshot() returns an image buffer. The documented formats are PNG, JPEG, and WebP, with PNG as the default. Its options include full-page capture, clipping, scale, and background handling. Use it when the output will be viewed, embedded as an image, or used for visual review and comparison.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →PDFs produce paginated documents
page.pdf() returns a PDF buffer. Its layout follows print CSS unless you emulate another media type first. Paper format or dimensions, margins, page ranges, and preferCSSPageSize give you control over document layout; preferCSSPageSize defaults to false.
#1 Best Overall
- 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)
A screenshot of a long page may be useful for visual inspection, but it has no paper-page layout or page breaks. If a reader needs to print the result or navigate it as a document, use PDF generation and check how the page’s print styles divide the content.
Runnable JavaScript examples
Install Playwright and its Chromium browser with npm install playwright and npx playwright install chromium. Save the following as capture.mjs, then run node capture.mjs. Each branch writes the requested artifact.
Rank #2
- Wireless 3-in-1: Print | Copy | Scan
- Print up to 30 Pages Per Minute (BW, Letter)
- First Print Out in Approximately 5.3 Seconds (Letter)
- Auto 2-sided Printing
- Uses Toner 071 / 071 High-Capacity Toner
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
try {
await page.goto('https://example.com', { waitUntil: 'networkidle' });
const mode = process.argv[2] ?? 'screenshot';
if (mode === 'screenshot') {
await page.screenshot({ path: 'page.png', fullPage: true });
} else if (mode === 'pdf') {
await page.pdf({
path: 'page.pdf',
format: 'A4',
printBackground: true
});
} else if (mode === 'screen-pdf') {
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'page-screen-styles.pdf', format: 'A4' });
} else {
throw new Error('Choose screenshot, pdf, or screen-pdf');
}
} finally {
await browser.close();
}
Run node capture.mjs screenshot for a full-page image, node capture.mjs pdf for a paginated PDF using print media, or node capture.mjs screen-pdf for a PDF rendered with screen media.
Capture just an element or region
For an element image, locate it and call screenshot on the locator:
Rank #3
- FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing, scanning and copying professional-quality black & white documents and reports. Perfect for 1-3 people
- WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing, scanning, and copying 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
- EASILY COPY ID CARDS AND MORE – Copy both sides of ID cards or other small-size documents onto the same side of one sheet of paper
await page.locator('main article').screenshot({ path: 'article.png' });
For a selected viewport region, pass a clip rectangle to page.screenshot():
await page.screenshot({
path: 'region.png',
clip: { x: 40, y: 80, width: 800, height: 600 }
});
These are image captures; use PDF generation instead when the output needs page dimensions and pagination.
Rank #4
- FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for offices printing, scanning and copying black & white brochures, business documents and presentations. Perfect for 1-5 people
- FASTEST TWO-SIDED PRINTING IN ITS CLASS – Up to 28 black-and-white pages per minute single-sided. Quickly finish multipage print projects with the fastest in-class two-sided printing speed
- DUAL-BAND WI-FI WITH SELF-RESET – Automatically detects and resolves connectivity issues
- STRONG SECURITY – Built-in security features help protect your printer from potential attacks
- PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Ethernet included. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more.
PDF settings that change the result
- Media type: Print CSS is used by default. Call
await page.emulateMedia({ media: 'screen' })beforepage.pdf()if the PDF should use screen styles. - Paper and dimensions: Use
formatfor a paper format such as'A4', or set width and height. Margins, page ranges, andpreferCSSPageSizealso affect layout. - Backgrounds:
printBackgrounddefaults tofalse. Set it totruewhen background graphics are needed in the PDF. - Colors: Print color handling may differ from screen appearance. The API documents
-webkit-print-color-adjustfor requesting exact colors through print CSS.
Choose these settings for the intended document rather than assuming a PDF will match the browser viewport exactly.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Common problems and fixes
The PDF looks different from the page
That is expected when the page has print-specific CSS: PDF generation uses print media by default. If the intended output should follow screen styles, emulate screen media before calling page.pdf(). If print styling is intended, inspect the print layout and adjust the page’s print CSS.
Best Value
- FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black-and-white documents and reports. Print speeds up to 35 ppm black.
- PROFESSIONAL PRODUCTIVITY – Proficiency with every print—bring your business to life with toner designed for sharp, professional-quality prints
- UPGRADED FEATURES – Fast printing, scanning and copying, auto 2-sided printing, a 250-sheet input tray and 50-sheet auto document feeder
- AWARD-WINNING RELIABILITY – Performance you can count on page after page, and always ready for the high demands of business
- WIRELESS PRINTING – Stay connected with our most dependable Wi-Fi, which looks for the best connection to stay online
Background graphics are missing
PDF background printing is off by default. Set printBackground: true when backgrounds should appear.
Colors do not match the screen
PDF colors are adjusted for printing by default. If exact colors matter, use the documented print CSS adjustment -webkit-print-color-adjust and inspect the generated PDF.
A full-page screenshot is not suitable for printing
fullPage: true captures one image of the full scrollable page. It does not create paper-sized pages or page breaks. Use page.pdf() for a paginated document.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRepeated captures differ
Appearance can depend on the page’s CSS, fonts and assets, browser, and runtime environment. For meaningful comparisons, use the same browser and environment, then verify the output against the target page. This is especially important when fonts or page assets affect layout.
Or skip the browser setup
If you need an image capture without running Playwright yourself, ScreenshotNeo is a website screenshot API. This is an alternative for screenshots, not a replacement for Playwright’s PDF generation.
Quick Recap
One GET request returns a screenshot:
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 documentation for request options. Before the shot, it accepts cookie or consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets; each step 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. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan.
How to decide reliably
- Decide whether the consumer needs an image or a document. Choose screenshot for an image; choose PDF for a paginated, printable deliverable.
- For an image, choose viewport, element, clip, or full-page capture. Remember that full-page means one tall image.
- For a PDF, decide whether print or screen CSS should govern the layout, then set paper, margins, page range, background, and color behavior as needed.
- Render the artifact in the browser and environment you intend to use, then inspect the actual output; page styling and runtime assets affect appearance.
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.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →




