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

Use Puppeteer to open a page in Chromium, wait until the content you need is ready, and call page.pdf() to save it. The example below checks the page response, waits for a meaningful page element, and writes an A4 PDF. Puppeteer’s PDF output uses print styling unless you explicitly emulate screen media.

Set up Puppeteer

The example uses the current Puppeteer API documented for version 25.12.0. Install Puppeteer in a Node.js project; its package includes a compatible browser installation flow.

npm install puppeteer

Save the following as save-page-as-pdf.mjs. Replace the URL and readiness selector with values appropriate for the page you are permitted to access.

import puppeteer from 'puppeteer';

const url = 'https://example.com';
const outputPath = 'page.pdf';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  const response = await page.goto(url, {
    waitUntil: 'domcontentloaded',
  });

  if (response && !response.ok()) {
    throw new Error(`Page request failed: ${response.status()}`);
  }

  // Choose an element that appears when the content you need is ready.
  await page.locator('main').wait();

  await page.pdf({
    path: outputPath,
    format: 'A4',
    printBackground: true,
  });
  console.log(`Saved ${outputPath}`);
} finally {
  await browser.close();
}

Run it with node save-page-as-pdf.mjs. The selector main is illustrative: use a selector tied to the target page’s actual content. The navigation condition and selector must also suit the site; the code is an example assembled from Puppeteer’s documented APIs, not a claim of testing against every website. See Puppeteer’s getting started guide, navigation API, PDF API, and PDF options.

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

Wait for the content you intend to capture

page.goto() completes according to its waitUntil option, but a navigation event does not necessarily mean that a client-rendered application has filled in the section you plan to print. The example first waits for a page element using a locator. Choose a selector that signals useful content, such as the article body, rather than a generic element that appears before loading is complete.

For a condition that cannot be expressed as a selector, use page.waitForFunction() to wait for a page-specific state—for example, a known loading indicator to disappear or a value to become available. Puppeteer documents locator-based waits and custom page conditions in its page interactions guide and waitForFunction API. Avoid treating an arbitrary fixed delay as proof that the page is ready; network and rendering time vary.

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 PDF appearance and layout

Print or screen styling

page.pdf() renders using print CSS. This is generally appropriate when a site has print-specific layout rules. If you need the PDF to reflect screen media styling instead, call await page.emulateMediaType('screen') before generating it. Puppeteer notes that PDF rendering also adjusts colors for printing; see the Page class documentation.

Paper, orientation, margins, and page ranges

Use PDF options to specify a paper format such as A4 or set custom dimensions, choose landscape orientation, define margins, or limit output to selected pages with a page range. Set these explicitly when the destination has fixed requirements. Consult the PDFOptions interface for supported option names and accepted values.

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 fonts

Background graphics are off by default. Set printBackground: true when the page’s colored areas or background images are important to the result, then review the generated PDF. The documented waitForFonts default is true, which helps when font loading affects layout. Puppeteer notes that font waiting may require bringing a background page to the front.

Check navigation results and close the browser

page.goto() resolves with the main resource response after redirects, and its documented return value can be null in some cases. When a response is available, checking response.ok() catches unsuccessful HTTP status codes; it does not guarantee that the rendered page contains the information you wanted, which is why a content-specific readiness check is useful too. Navigation behavior and response details are documented in the Page.goto API.

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

Keep browser shutdown in a finally block. That ensures the launched browser is closed if navigation, waiting, or PDF generation throws an error. The same create-browser, create-page, navigate, and close sequence appears in Puppeteer’s getting started guide.

Respect site access rules

Automating a browser does not itself grant permission to access or copy a page. Check the site’s applicable terms and access controls. The IETF’s RFC 9309, Robots Exclusion Protocol describes robots.txt as crawler guidance and explicitly states: “These rules are not a form of access authorization.” Robots rules and permission are separate questions.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common problems and fixes

  • The PDF is missing page content: the navigation event may have happened before the application rendered the needed content. Replace the generic selector with a specific readiness selector, or wait for a custom condition with page.waitForFunction().
  • The PDF looks different from the browser: page.pdf() uses print media by default. Keep that if print layout is desired; otherwise call page.emulateMediaType('screen') before creating the PDF.
  • Colors or background images are absent: set printBackground: true; the default is false.
  • The script reports a failed page request: inspect the status shown by the error. A completed navigation is not proof of a successful HTTP response, and redirects or site responses may affect what is returned.
  • The script waits forever or exits before producing a PDF: verify that the selector exists on the target page and actually becomes available. Choose a condition aligned with the site’s loading behavior rather than relying on a delay.
  • The browser remains running after an error: ensure the PDF and navigation work is inside a try block paired with finally { await browser.close(); }.

Or skip the browser setup

If you need a screenshot or PDF rather than a custom Puppeteer workflow, ScreenshotNeo offers a one-request website screenshot API and MCP server. For a PDF, add the PDF output option as described in 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

ScreenshotNeo removes cookie and consent banners, 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 are not billed, and responses identify 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 shots.

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

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.

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