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

Yes—but not by launching Puppeteer inside the tab. A browser-compatible Puppeteer client can connect over WebSocket to an already-running browser and call page.pdf(). The browser page cannot launch or download that controlled browser because those operations require Node.js APIs. For a normal application, run the browser process in Node or a managed browser service, then let frontend code request the resulting PDF or connect to a deliberately exposed endpoint.

What “in a browser” actually means

There are two different scenarios that are often confused:

  • Server-side Puppeteer: Node.js launches (or connects to) Chromium, navigates a page, calls page.pdf(), and returns or stores the bytes.
  • Browser-side Puppeteer: JavaScript running in a webpage uses Puppeteer’s browser-compatible bundle to connect to a remote browser through a WebSocket endpoint. That client can manage pages and generate a PDF, but it does not start the browser process.

The official browser-running guidance states that launching or downloading browsers directly is not supported in this environment because it relies on Node.js APIs. The remote browser must therefore be started and secured by a server, CI worker, container, or browser service.

This is different from calling window.print(). The print dialog uses the user’s local browser and gives limited automation. Puppeteer’s page.pdf() controls a separate Chromium page and returns generated PDF data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
  • COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
  • ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
  • HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs

The normal Node.js workflow

For most backends, this is the simplest and safest design: launch or connect to Chromium on the server, navigate, generate the PDF, and close or reuse the browser.

Minimal PDF generation

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
const pdfBytes = await page.pdf({
  format: 'A4',
  printBackground: true
});
await browser.close();

// pdfBytes is a Uint8Array

page.pdf() has the signature pdf(options?: PDFOptions): Promise<Uint8Array>. The byte array can be sent in an HTTP response, written to object storage, or handed to another browser API. A server does not have to write a temporary file.

Return the PDF from an HTTP endpoint

import express from 'express';
import puppeteer from 'puppeteer';

const app = express();
const browser = await puppeteer.launch();

app.get('/pdf', async (req, res) => {
  const target = typeof req.query.url === 'string'
    ? req.query.url
    : 'https://example.com';

  try {
    const page = await browser.newPage();
    await page.goto(target, { waitUntil: 'networkidle2' });
    const pdfBytes = await page.pdf({
      format: 'A4',
      printBackground: true
    });
    await page.close();

    res.type('application/pdf').send(Buffer.from(pdfBytes));
  } catch (error) {
    res.status(502).json({ error: 'PDF generation failed' });
  }
});

app.listen(3000);

Validate or allow-list destination URLs in a real service. Otherwise, an endpoint that accepts arbitrary URLs can become a server-side request forgery (SSRF) gateway. Set navigation timeouts, limit page counts and size, and close each page in a finally block when handling untrusted input.

Calling page.pdf() from frontend JavaScript

Use the browser build from puppeteer-core, connect to a valid browser WebSocket endpoint, obtain a page, and call the same PDF method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';

const browser = await puppeteer.connect({
  browserWSEndpoint: wsUrl
});

const pages = await browser.pages();
const page = pages[0] ?? await browser.newPage();
const pdfBytes = await page.pdf({
  format: 'A4',
  printBackground: true
});

browser.disconnect();

// pdfBytes is a Uint8Array

wsUrl must point to a browser that is already running and reachable from the page. Do not put an unprotected endpoint in public frontend code: anyone who obtains it may control that browser, inspect pages, or consume resources. In production, prefer a short-lived, authenticated connection broker or keep all Puppeteer work on the server.

Deliver the returned bytes in the browser

Because the result is a Uint8Array, frontend code can turn it into a Blob and start a download without asking a server to write a local path:

const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const objectUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = objectUrl;
link.download = 'document.pdf';
link.click();
URL.revokeObjectURL(objectUrl);

For large documents, returning the bytes through your server is usually easier to authenticate, log, rate-limit, and stream. The browser-side approach is most appropriate when you intentionally operate a trusted remote-browser service.

Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
  • INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
  • PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
  • ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴

Package choice and runtime requirements

puppeteer versus puppeteer-core

Package Browser handling Typical use
puppeteer Downloads a compatible Chrome version during installation. Node applications that manage their own browser.
puppeteer-core Does not download Chrome. Applications connecting to a remote or separately managed browser.

The browser-compatible import shown above comes from puppeteer-core. Installing the full puppeteer package does not make browser-page JavaScript able to launch Chromium; launch and download operations still depend on Node-specific APIs.

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

Match versions deliberately

The current Puppeteer system-requirements line lists Node 22.12 or newer and Chrome for Testing platform requirements. These requirements are release-sensitive. Pin Puppeteer and the browser image together, then verify the pair in CI and deployment. A browser that is too old or too new can produce connection failures, missing protocol methods, or rendering differences.

How PDF rendering behaves

Print media is the default

page.pdf() renders with the print CSS media type by default. If the document should look like its screen layout, select screen media first:

await page.emulateMediaType('screen');
const pdfBytes = await page.pdf({
  format: 'A4',
  printBackground: true
});

Fonts, colors and backgrounds

The documented PDF flow waits for fonts by default. Use printBackground: true when background fills or images are part of the design. Printing can alter colors; add -webkit-print-color-adjust: exact in your print stylesheet when exact color reproduction matters, while recognizing that printers and viewers can still apply their own color management.

Paper, layout and pagination controls

PDFOptions supports paper formats such as A4, custom width and height, margins, landscape orientation, page ranges, background printing, and header/footer templates. Header and footer templates can use substitution classes including date, title, url, pageNumber, and totalPages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const pdfBytes = await page.pdf({
  format: 'A4',
  landscape: false,
  printBackground: true,
  margin: { top: '18mm', right: '14mm', bottom: '18mm', left: '14mm' },
  displayHeaderFooter: true,
  headerTemplate: '<span class="title"></span>',
  footerTemplate: '<span class="pageNumber"></span> / <span class="totalPages"></span>',
  pageRanges: '1-3'
});

Test page breaks with the actual content, fonts, viewport and browser version used in deployment. CSS such as break-before, break-after and break-inside can help, but complex layouts still need visual checks.

Security and architecture decisions

  • Where does Chromium run? A Node process, container, CI worker, or managed browser service should own the process.
  • Who can reach the WebSocket? Keep it private or require authentication and short-lived authorization. Never expose a raw debugging endpoint to the public internet.
  • Where are bytes produced? A server can return Uint8Array bytes as application/pdf; browser code can wrap them in a Blob.
  • How is work isolated? Use a fresh page per job, clear cookies when handling unrelated users, and close pages after failures.
  • How is concurrency controlled? Reuse a browser where appropriate, but cap simultaneous pages and queue jobs so memory and CPU do not exhaust the host.

For untrusted URLs, restrict protocols and destinations, block private network ranges, enforce navigation and total-job timeouts, and avoid passing secrets from the frontend into page scripts.

Rank #3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
  • SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
  • INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
  • KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
  • PREMIUM SUPPORT - Strong technical expertise to solve issues faster
  • THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.

Common failures and fixes

“Cannot launch browser” in frontend code

Cause: The page imported a Node-oriented bundle or called puppeteer.launch(). Fix: Use the browser-compatible puppeteer-core build and connect with browserWSEndpoint. Start Chromium on a server or managed service.

WebSocket connection refused or times out

Cause: The endpoint is wrong, unreachable from the user’s network, expired, or blocked by a firewall. Fix: Verify the endpoint from the same network as the frontend, expose it only through an authenticated broker, and confirm the remote browser is running.

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.

PDF has screen styling missing

Cause: Print media is the default. Fix: Call await page.emulateMediaType('screen') before page.pdf(), and ensure the required stylesheets have loaded.

Backgrounds or colors look wrong

Cause: Background printing is disabled or print color adjustment changes output. Fix: Set printBackground: true and, when appropriate, use -webkit-print-color-adjust: exact.

Blank, incomplete or stale pages

Cause: The page was captured before application data, fonts, or images finished loading. Fix: Wait for a meaningful selector or application-ready signal after navigation, use an appropriate waitUntil setting, and verify the final DOM before generating the PDF.

Large jobs consume too much memory

Cause: Too many concurrent pages, very tall documents, or unbounded navigation. Fix: Queue work, cap concurrency, set timeouts and page-size limits, and close pages in cleanup code.

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

Package and browser protocol mismatch

Cause: Puppeteer and Chrome versions were upgraded independently. Fix: Pin both, use the browser version supported by that Puppeteer release, and run a smoke test that connects, navigates and generates a one-page PDF.

Rank #4
Sale
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
  • No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
  • Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
  • Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
  • The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a website capture API with PDF output, so your application can make one authenticated request instead of managing Chromium and a WebSocket endpoint. It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. It also offers an MCP server for AI agents, including Claude and Cursor, with take_screenshot, get_page_info and capture_pdf tools.

See the parameter reference in the ScreenshotNeo documentation. A PDF request can use the same endpoint:

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

Python:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={
        "access_key": "YOUR_API_KEY",
        "url": "https://example.com",
        "format": "pdf",
    },
    timeout=90,
)
r.raise_for_status()
open("document.pdf", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com',
  format: 'pdf'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`ScreenshotNeo request failed: ${res.status}`);
const bytes = await res.arrayBuffer();
await Bun.write('document.pdf', bytes);

Every feature is included on every plan. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.

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.

FAQ

Can a browser tab generate a PDF without any server?

Not with Puppeteer’s page.pdf(). A browser tab can use its own print dialog, but Puppeteer requires a connected browser instance and the browser-page build cannot launch or download that instance.

Does page.pdf() save directly to the user’s computer?

Its documented return value is a Uint8Array. Convert those bytes to a Blob for a browser download, or send them from a server with the application/pdf content type.

When should I use a remote browser endpoint?

Use one when browser startup is centralized in a service or worker and you can authenticate and isolate each connection. For a conventional backend, keeping Puppeteer and Chromium together on the server is simpler.

Why can two machines produce different PDFs?

Fonts, Chromium/Puppeteer versions, operating-system libraries, viewport settings and CSS media selection all affect rendering. Pin the runtime and test the same browser image used in production.

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

Frequently Asked Questions

Can I call page.pdf() from a React component?

Only if the component connects to an intentionally exposed, authenticated remote browser endpoint using the browser-compatible Puppeteer bundle. It cannot start Chromium in the user’s tab.

Can I use puppeteer-core without installing Chrome?

Yes. puppeteer-core does not download Chrome, but a compatible browser must already be available locally or remotely.

How do I make a PDF use screen CSS?

Call await page.emulateMediaType(‘screen’) immediately before page.pdf().

Quick Recap

Bestseller No. 3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
PREMIUM SUPPORT - Strong technical expertise to solve issues faster; THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
$194.03

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.