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

Use Playwright’s page.pdf() to save a web page as a paginated PDF; use page.screenshot() for an image. A full-page screenshot is still an image, not a PDF. Playwright renders PDFs with print CSS by default, so switch to screen media before export if you want the page’s screen layout.

Choose the right Playwright method

What you need Use What it creates
A printable document page.pdf() A paginated PDF, rendered with print CSS by default
A viewport or full-length image page.screenshot() An image such as PNG, JPEG, or WebP; it does not create a PDF
A repeatable visual-regression check Playwright Test’s expect(page).toHaveScreenshot() A screenshot assertion against a baseline image, not a PDF export

The official Page API documents the PDF and screenshot methods separately. The screenshot guide covers saving screenshots to files or buffers.

Save a web page as a PDF

After navigating to the page, call page.pdf(). Pass a file path to save the returned PDF buffer to disk:

await page.goto('https://example.com');
await page.pdf({ path: 'page.pdf', format: 'A4', printBackground: true });

This example requests A4 paper and includes background graphics. If you omit path, the method returns a PDF buffer that your code can handle or store itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Set paper size, margins, and pages

Use format for a paper preset, or set width and height directly. Supported units include pixels, inches, centimeters, and millimeters; unlabeled width and height values are pixels. Other useful PDF options are:

  • margin to set page margins.
  • pageRanges to export selected pages.
  • printBackground to include background graphics.
  • preferCSSPageSize: true to give the document’s CSS @page size priority over width, height, or format.

For example, a project may use await page.pdf({ path: 'report.pdf', format: 'A4', margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' }, printBackground: true, pageRanges: '1-3' });. Check the resulting file: page breaks and print styles are controlled by the page as well as by your export options.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Choose print or screen styling in the PDF

PDF export uses print CSS media by default. If the page’s print stylesheet changes the layout or hides elements you want, emulate screen media before calling page.pdf():

await page.goto('https://example.com');
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'page-screen.pdf', printBackground: true });

Screen media changes which CSS media rules apply; it does not turn the PDF into a screenshot. Review the output because the site’s styles can still affect its appearance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Backgrounds and print colors

printBackground: true controls whether background graphics are printed. It is separate from print color adjustment: Playwright documents -webkit-print-color-adjust for forcing exact colors when print rendering modifies them. If brand colors or shaded sections look different, check both this CSS behavior and the page’s print rules.

Capture a full-page screenshot as an image

To capture the entire scrollable page as an image, set fullPage: true:

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
await page.goto('https://example.com');
await page.screenshot({ path: 'full-page.png', fullPage: true });

Without fullPage: true, the screenshot is generally limited to the viewport. Screenshot options also include clipping coordinates, output type, lossy-image quality, and scale. scale: 'css' uses one image pixel per CSS pixel; scale: 'device' uses device pixels and can produce a larger image on high-DPI displays. These settings apply to screenshot output, not PDF pagination.

Run a visual screenshot check consistently

For visual regression testing, Playwright Test’s expect(page).toHaveScreenshot() compares against a baseline image. The assertion waits for consecutive screenshots to match before comparing. It is not a way to export a PDF.

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.
Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

Rendering can vary with the host operating system, browser version, settings, hardware, power source, and headless mode. Keep the baseline-generation and comparison environments consistent; otherwise, environment differences can cause screenshot changes unrelated to the page code. See the official visual comparisons guide.

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

Troubleshoot common output problems

  • The PDF is missing screen-only styling: Call await page.emulateMedia({ media: 'screen' }) before page.pdf().
  • PDF colors or backgrounds look wrong: Set printBackground: true if background graphics are missing. For adjusted print colors, inspect the CSS print rules and consider -webkit-print-color-adjust.
  • The screenshot only shows the visible area: Add fullPage: true to page.screenshot(). This makes a longer image, not a PDF.
  • Visual tests differ between machines: Align the operating system, browser version, settings, hardware, and headless configuration used for the baseline and comparison where possible.
  • The PDF’s size or pagination is unexpected: Check the page’s @page rules, your paper dimensions, margins, and preferCSSPageSize; inspect the generated PDF to verify the result.

Or skip the browser setup

If you need a screenshot or PDF from an API rather than running Playwright, ScreenshotNeo returns one from a GET request. For example, save a web page as a PDF:

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

See the ScreenshotNeo documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Frequently Asked Questions

Can a full-page Playwright screenshot be saved directly as a PDF?

No. Use page.pdf() to create a PDF; page.screenshot({ fullPage: true }) creates a full-length image.

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

Does Playwright’s PDF export use print or screen CSS by default?

It uses print CSS media by default. Call page.emulateMedia({ media: 'screen' }) before export when you want screen media rules.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.