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

First determine whether the site downloads the PDF as an attachment or opens it as a PDF document in Chrome’s viewer. For an attachment, wait for Playwright’s download event and save the resulting file. For a PDF opened in the viewer, use the site’s download control or obtain the PDF response through the authenticated browser session; direct PDF navigation has a documented limitation in headless mode. page.pdf() is different: it creates a PDF from the current page rather than downloading the original file.

Choose the right method: attachment or PDF navigation

A PDF’s appearance in Chrome’s built-in viewer does not tell you whether the site initiated a file download. Playwright handles an attachment download and navigation to a PDF document as distinct flows. The right approach depends on what happens after the link is activated, whether the site requires login, and whether you need the original PDF bytes or a newly printed copy of a web page.

  • Attachment: the site sends a file download. Listen for Playwright’s download event and save the Download object.
  • PDF navigation: the browser opens a PDF document in its viewer. In headless mode, Playwright documents that navigation to a PDF document is not supported.
  • Print output: Playwright’s page.pdf() or Chrome’s --print-to-pdf creates a PDF from page content; neither is a general method for retrieving the original PDF shown in the viewer.

Playwright’s Page API states: “Headless mode doesn’t support navigation to a PDF document.” See the Playwright Page API. The behavior of a particular site can still depend on its authentication, response headers, viewer, and browser configuration.

Save a PDF that the site downloads as an attachment

Register the download listener before clicking. This ordering matters: if the click is performed first, a quick download may begin before the script is waiting for its event. The following JavaScript example saves the download to a known path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
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
const downloadPromise = page.waitForEvent('download');
await page.getByRole('link', { name: 'Download PDF' }).click();
const download = await downloadPromise;
await download.saveAs('/path/to/file.pdf');

The link name and output path are examples; use a locator that matches the actual page and a path writable by the process. Playwright documents the download event and the Download object in its BrowserContext API. Download acceptance is configured on the browser context; consult the same API’s acceptDownloads option when constructing the context.

Complete JavaScript example

This example assumes Playwright is installed and a browser is available. Replace the URL, locator, and destination with the site-specific values. It uses Chromium headless for the attachment flow; it does not attempt to navigate directly to a PDF viewer document.

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

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext({ acceptDownloads: true });
  const page = await context.newPage();

  try {
    await page.goto('https://example.com/documents');
    const downloadPromise = page.waitForEvent('download');
    await page.getByRole('link', { name: 'Download PDF' }).click();
    const download = await downloadPromise;
    await download.saveAs('/path/to/file.pdf');
  } finally {
    await browser.close();
  }
})();

If the site requires authentication, establish that session before clicking—for example, by signing in through the page or by loading the appropriate saved browser state. Use only accounts and files you are authorized to access. The exact login flow and download locator are specific to the site.

Rank #2
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

When clicking opens Chrome’s PDF viewer instead

If the click does not produce a download event, inspect what the page did rather than assuming the event listener is broken. A link may have navigated to a PDF document, opened a new page, or made a request that returned a PDF while Chrome displayed it in the viewer. A completed HTTP response is not the same thing as a Playwright attachment download.

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. Click while listening for the download event. If it fires, save that Download object as above.
  2. If it does not fire, inspect the page and network behavior: check whether a page or popup navigated, and examine response events and request lifecycle events.
  3. If the target is a PDF document and your script is headless, account for Playwright’s documented PDF-navigation limitation.
  4. Look for the website’s own download action. If none is available, assess whether you can retrieve the PDF response through the same authenticated browser session.

Playwright documents response events and request lifecycle behavior in its Page API and Request API. Those APIs do not establish one universal route for extracting PDFs from every viewer implementation. Treat response capture as site-specific: verify the response status, content type, and saved file bytes rather than assuming that any response is the desired PDF.

Use the site’s download control when available

A viewer toolbar may offer a download action, but its controls and accessibility labels are not uniform across sites and viewer implementations. Do not rely on a generic selector as if it were a stable Playwright interface. Inspect the actual page in the browser mode you will run, identify the control exposed by that site, and use a locator appropriate to it. If the control triggers an attachment, wait for the download event before activating it.

Rank #3
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)

Retrieve a response only when you can verify it

For a site that serves the PDF through an authenticated request, a response observed in the same browser context may be useful. The relevant URL, request, and response are implementation-dependent; the reviewed Playwright references do not promise that every Chrome viewer exposes the source through a uniform event or DOM element. Confirm that the response corresponds to the document you want, that it succeeded, and that the bytes form a valid PDF. Respect the site’s access controls and terms.

Do not confuse downloading with printing to PDF

page.pdf() creates a PDF from the current page

Playwright’s page.pdf() returns a PDF buffer for the current page, uses print CSS media by default, and can save to a path when a path option is supplied. It is for generating a PDF representation of page content, not exporting the source PDF currently rendered in Chrome’s viewer. See the Page API.

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

Chrome’s --print-to-pdf is also page printing

Chrome documents --print-to-pdf as saving the target page to output.pdf. That describes printing a web page to PDF, not downloading a source PDF opened in the viewer. See Chrome’s headless documentation.

Rank #4
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
  • INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
  • SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
  • EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
  • SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning

Choose the browser mode that matches your target

If your workflow depends on Chrome’s built-in viewer, test with the same browser channel and mode that will run in production. Playwright documents launching branded Google Chrome with the chrome channel, and notes that Chrome’s newer headless mode differs from Playwright’s default Chromium headless shell. Behavior observed in one configuration should not be assumed to transfer unchanged to another. Refer to Playwright browser documentation.

Managed environments can add another variable: enterprise browser policies may affect Playwright’s ability to launch or control Chrome and Edge, as the browser documentation also notes. A launch or control failure may therefore be a policy or setup issue rather than a PDF-handling issue.

Troubleshooting common failures

  • No download event appears: the link may open a PDF document or trigger another navigation instead of an attachment download. Inspect page and network behavior; try the site’s own download control or a verified authenticated-response approach.
  • Headless navigation to the PDF fails: this is consistent with Playwright’s documented headless limitation. Avoid direct navigation as the retrieval method; use an attachment flow, the site’s download action, or a verified response route.
  • The script misses a fast download: create the waitForEvent('download') promise before clicking, then await it and save the Download object.
  • The file is missing or cannot be written: check that downloads are accepted for the browser context and that the destination path exists and is writable. Choose an explicit destination with saveAs().
  • The saved response is not the PDF you expected: inspect its status and content type and validate the file bytes. A response event alone does not establish that it is the desired document.
  • Chrome behaves differently across machines: compare the browser channel and headless/headed mode, and check whether enterprise policies affect the managed installation.
  • You have a PDF, but its content is wrong: verify whether you used page.pdf() or --print-to-pdf. Those print page content; they do not retrieve the original viewer PDF.
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 the goal is a screenshot of a page rather than downloading the original PDF, ScreenshotNeo offers a one-request screenshot API. Its capture can accept cookie/consent banners and remove known consent platforms, newsletter popups, and chat widgets before the shot; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. It also provides an MCP server with screenshot, page-info, and PDF-capture tools for AI agents. This is not a substitute for fetching the original PDF file.

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

Example cURL request (replace the target URL and API key):

Best Value
Sale
ScanSnap iX1300 Wireless or USB Double-Sided Color Document Scanner, Black
  • FITS SMALL SPACES AND STAYS OUT OF THE WAY. Innovative space-saving design to free up desk space, even when it's being used
  • SCAN DOCUMENTS, PHOTOS, CARDS, AND MORE. Handles most document types, including thick items and plastic cards. Exclusive QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • GREAT IMAGES EVERY TIME, NO EXPERIENCE REQUIRED. A single touch starts fast, up to 30ppm duplex scanning with automatic de-skew, color optimization, and blank page removal for outstanding results without driver setup
  • SCAN WHERE YOU WANT, WHEN YOU WANT. Connect with USB or Wi-Fi. Send to Mac, PC, mobile devices, and cloud services. Scan to Chromebook using the mobile app. Can be used without a computer
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. ScanSnap Home all-in-one software brings together all your favorite functions. Easily manage, edit, and use scanned data from documents, receipts, business cards, photos, and more
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 API documentation for the request details. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month with no card.

Practical decision checklist

  • Need the original file, and the site sends an attachment? Wait for Playwright’s download event and save it.
  • Does clicking open a viewer? Inspect navigation and responses; prefer a site-provided download action or a verified response from the authenticated session.
  • Is the workflow headless? Do not rely on direct PDF-document navigation.
  • Does the task actually call for a new PDF of HTML page content? Then use page.pdf() or Chrome printing, not a source-file download workflow.
  • Does the viewer behavior itself matter? Match the Chrome channel and mode used in the real run.

Frequently Asked Questions

Does Playwright’s download event fire whenever Chrome displays a PDF?

No. The event is for download flows such as attachments; a PDF navigation in Chrome’s viewer is a distinct flow.

Can I use ScreenshotNeo to download the original PDF file?

No. ScreenshotNeo captures a screenshot or PDF output; it is not a method for retrieving the original source PDF from Chrome’s viewer.

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

Quick Recap

Bestseller No. 1
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.