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

Both Puppeteer and Playwright can save a webpage as a PDF. Their PDF APIs render the page using print CSS by default; if you want screen styling instead, emulate the screen media type before generating the PDF. Choose between them mainly by the browser engines and automation needs of your project—not by an assumed speed or fidelity advantage. A PDF is a rendered representation, not by itself a complete, replayable archive of a website.

What these PDF files do—and do not—preserve

Both libraries turn a browser page into a PDF. That is useful for a readable snapshot or document, but the reviewed API documentation does not promise that the PDF also preserves the original HTML, every linked asset, response headers, metadata, or the conditions needed to replay the browsing session. If “archive” means more than a printable rendering, write down the preservation requirements separately and test that your output meets them.

Puppeteer vs. Playwright at a glance

Decision Puppeteer Playwright
Default PDF media Print CSS media Print CSS media
Use screen styling Emulate screen media before calling page.pdf(). Call page.emulateMedia({ media: 'screen' }) before page.pdf().
Save to disk The guide demonstrates page.pdf({ path: 'hn.pdf' }); the API returns a Uint8Array. Pass path to save a file. Without it, the PDF is returned as a buffer and is not saved to disk.
Browser options documented here The reviewed PDF material establishes the PDF workflow, not a complete browser-engine comparison. Playwright documents Chromium, WebKit, Firefox, and branded Chrome and Edge channels. That breadth may matter when your project needs non-Chromium automation.
Speed or PDF fidelity winner Not established by the reviewed official documentation; no comparative benchmark is available here.

The Playwright API documentation describes more PDF layout controls, including paper size or dimensions, margins, CSS page sizing, backgrounds, scale, and page ranges. That difference in documentation detail is not evidence that Puppeteer lacks equivalent controls. Check the current option reference for the library and version you use before relying on a specific setting.

Save a webpage as a PDF with Puppeteer

This CommonJS example launches a browser, opens a page, waits for navigation to reach the load event, writes a PDF, and closes the browser even if capture fails. Install Puppeteer in your project with npm install puppeteer, then save as save-pdf.cjs and run node save-pdf.cjs.

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.
#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
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'load' });
    await page.pdf({ path: 'page.pdf' });
  } finally {
    await browser.close();
  }
})().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Puppeteer’s PDF guide says PDF generation waits for fonts to load by default. Navigation waiting and PDF generation are separate concerns: choose an appropriate navigation condition for the site, and verify that content loaded after the initial page load is present in the resulting file.

Capture screen-styled output instead

PDF generation uses print media by default. To request screen CSS, emulate that media before generating the PDF:

await page.emulateMediaType('screen');
await page.pdf({ path: 'page.pdf' });

Save a webpage as a PDF with Playwright

Install Playwright with npm install playwright. Install the browser binaries required by your setup as directed by the Playwright installation documentation. This runnable CommonJS example saves a file and closes the browser reliably:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'load' });
    await page.pdf({ path: 'page.pdf' });
  } finally {
    await browser.close();
  }
})().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

To render with screen media rather than the default print media, set it before calling page.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.
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)
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'page.pdf' });

Playwright’s PDF API accepts a path and also returns PDF bytes. If you omit the path, handle the returned buffer yourself; the API does not save it to disk automatically.

Choose the rendering and page layout deliberately

Print versus screen media

Print and screen CSS can produce different layouts because a site may define different rules for each media type. Use the default print rendering for document-like output; explicitly emulate screen media when the screen stylesheet is the desired result. Inspect the PDF rather than assuming the two modes are interchangeable.

Colors and backgrounds

Print rendering may alter colors. When exact color treatment matters, use CSS -webkit-print-color-adjust as appropriate for the page, and check the output in the browser engine you will use. Playwright documents a printBackground PDF option for background graphics; set it deliberately when backgrounds matter rather than assuming they will appear.

Paper size, margins, scaling, and ranges

Playwright documents paper formats or explicit dimensions, margins, CSS @page sizing, scaling, and page ranges. These are useful when output must fit a target document size, omit pages, or follow styles embedded in the page. Verify the current Puppeteer API reference for equivalent option names and behavior if you need a feature-by-feature match; the concise Puppeteer guide reviewed here does not establish parity or a difference.

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

Which library should you choose?

  • Choose Puppeteer when its browser automation fits your project and a direct navigate-and-save PDF workflow is what you need.
  • Choose Playwright when the project benefits from its documented browser choices—including Chromium, WebKit, Firefox, and branded Chrome or Edge channels—or you want its documented PDF layout controls.
  • Do not choose on an unverified speed or fidelity claim. The official material reviewed does not establish that either library is faster or creates more faithful PDFs. Test representative pages in your own target browser and deployment environment.

Playwright’s engine breadth does not establish that PDFs will look identical across engines. If output consistency matters, pin the browser environment you use and compare actual documents from representative pages.

Troubleshooting PDF capture

The PDF looks like a print layout, not the webpage

Cause: PDF generation defaults to print CSS media. Fix: emulate screen media before calling page.pdf() if screen styling is required.

Colors or background graphics are missing or changed

Cause: print output can modify colors, and background graphics may require an explicit PDF option. Fix: use -webkit-print-color-adjust where appropriate, enable Playwright’s printBackground when needed, and inspect the produced PDF.

The PDF is not present at the expected path

Cause: in Playwright, omitting path returns PDF bytes rather than writing a file. Fix: pass a path or write the returned buffer yourself. In either library, check that the process has permission to write to the chosen location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

Content or fonts appear incomplete

Cause: the page may not have finished rendering the content you need when capture begins. Fix: choose a navigation wait condition suitable for the site, wait for the relevant content when necessary, and inspect the output. Puppeteer’s guide notes that Page.pdf() waits for fonts by default; this does not guarantee that every site-specific asynchronous update has completed.

Output differs between browser engines

Cause: supported browser choices do not imply identical PDF rendering. Fix: select the engine required by the project, test your target pages in that engine, and keep the capture environment consistent when repeatability matters.

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

Or skip the browser setup

If you need a quick rendered capture rather than a self-managed Puppeteer or Playwright workflow, ScreenshotNeo offers a website screenshot API and MCP server. Its API can return a PDF as well as PNG, JPEG, or WebP; the example below uses the documented image response, so it is not a PDF-generation call.

For PDF options and request details, see the ScreenshotNeo documentation.

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
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners 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, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Does either library create a complete website archive?

No such completeness is established by the PDF API documentation. Treat the result as a rendered PDF, and define and test any additional preservation requirements separately.

Can Playwright generate PDFs with WebKit or Firefox?

Playwright documents support for Chromium, WebKit, and Firefox, but the material reviewed does not establish cross-engine PDF parity. Test the engine you plan to use.

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

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.