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

Use Puppeteer’s page.screenshot() when the report should be an image of a viewport, full page, clipped region, or element. Use page.pdf() when you need a paginated document with paper size, orientation, margins, or page ranges. One important distinction: PDFs use print CSS by default, so a report can look different from its browser view.

Choose by the deliverable

Need Use Why
Preserve a visual state as an image page.screenshot() Captures a viewport or full page, or a clipped area; image format and quality can be configured. Puppeteer screenshot API
Capture just one chart, card, or report section elementHandle.screenshot() Captures an element and scrolls it into view if needed. Element screenshot API
Create a document for printing or sharing across pages page.pdf() Supports paper format, landscape orientation, margins, page ranges, print backgrounds, and optional headers and footers. PDF options
Make a PDF follow screen CSS rather than print CSS page.pdf() after selecting screen media Puppeteer selects print media by default; call page.emulateMediaType('screen') before generating the PDF. PDF API

There is no universal speed, file-size, or quality winner established by the Puppeteer documentation. Choose based on whether the recipient needs an image or a paginated document, then verify the output against the intended screen or print styling.

Capture an HTML report as a screenshot

This example opens a report URL, waits for the page to load, and writes a full-page PNG. Install Puppeteer in your project with npm install puppeteer; Puppeteer’s browser installation behavior depends on the installed package and setup, so consult the installation guide if launch fails.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com/report', { waitUntil: 'networkidle0' });
    await page.screenshot({ path: 'report.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

Replace the example URL with a report you are authorized to access. For a viewport-only image, omit fullPage: true. For a JPEG or WebP capture, specify type: 'jpeg' or type: 'webp'; quality applies to JPEG and WebP, not PNG. Screenshot option details are in the screenshot options reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Capture one element

const reportSection = await page.$('#report-summary');
if (!reportSection) throw new Error('Report section not found');
await reportSection.screenshot({ path: 'summary.png' });

The element screenshot method brings the target into view if necessary before capturing it. A missing selector should be handled explicitly rather than silently producing a different capture.

Generate a paginated PDF

Use page.pdf() when the report must fit a paper-oriented document workflow. This example writes a Letter PDF with backgrounds included:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com/report', { waitUntil: 'networkidle0' });
    await page.pdf({
      path: 'report.pdf',
      format: 'Letter',
      printBackground: true,
      margin: { top: '0.5in', right: '0.5in', bottom: '0.5in', left: '0.5in' }
    });
  } finally {
    await browser.close();
  }
})();

The PDF options reference documents Letter as the default format. Set options explicitly when reproducibility matters instead of relying on defaults that may be overlooked when the script is maintained.

Set orientation, page range, and CSS page sizing

await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  landscape: true,
  pageRanges: '1-3',
  preferCSSPageSize: true,
  printBackground: true
});

pageRanges limits output to selected pages. preferCSSPageSize: true gives CSS @page sizing priority; by default, Puppeteer scales content to fit the selected paper size. The PDF options reference also documents margins, displayHeaderFooter, and waitForFonts (documented default: true, waiting for document.fonts.ready). See PDF options for supported values and details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Canon imageCLASS MF273dw - Monochrome Wireless Laser Printer, Multifunction With Scanner, Copier, Auto Document Feeder, With 1 Year Limited Warranty, 30 PPM, Black
  • Wireless 3-in-1: Print | Copy | Scan
  • Print up to 30 Pages Per Minute (BW, Letter)
  • First Print Out in Approximately 5.3 Seconds (Letter)
  • Auto 2-sided Printing
  • Uses Toner 071 / 071 High-Capacity Toner

Control screen and print styling

PDF generation uses the page’s print media styles by default. If the report’s screen layout is the one you want in the PDF, select screen media before calling page.pdf():

await page.emulateMediaType('screen');
await page.pdf({ path: 'report-screen-layout.pdf', printBackground: true });

Conversely, leave the default print media behavior in place when the report has deliberate print rules, such as page breaks or print-specific layout. Check the generated pages: selecting screen media changes which CSS rules apply, but it does not turn the PDF into a screenshot or remove pagination.

Preserve print colors when needed

Puppeteer notes that PDF colors are modified for printing by default. If matching the authored colors is important, apply print-color styling in the page’s CSS, such as -webkit-print-color-adjust: exact, and inspect the output. This is a styling choice to validate in your report, not a guarantee that every printer will render colors identically. See the PDF API documentation.

Choose capture scope and image options

  • Viewport image: use page.screenshot() without fullPage or clip.
  • Whole document image: set fullPage: true; this remains one image, not a multi-page document.
  • Specific rectangle: pass a clip region to the screenshot call.
  • Single component: use ElementHandle.screenshot() when a selector identifies the target.
  • Transparent output: screenshot options include omitBackground; use it where a transparent image is required.
  • Format and quality: set the image type as needed; quality is not applicable to PNG.

These controls are documented in the screenshot options reference and the screenshot guide.

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.
Rank #3
HP Laserjet MFP M140w Wireless Black & White Printer, Print, scan, Copy, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing, scanning and copying professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing, scanning, and copying that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • EASILY COPY ID CARDS AND MORE – Copy both sides of ID cards or other small-size documents onto the same side of one sheet of paper

Wait for the report to be ready

Navigation completion does not always mean a report’s data, charts, or images have finished rendering. Choose a wait condition that matches the page. Puppeteer’s goto() supports navigation wait conditions; for a report with a clear readiness marker, waiting for a selector is often more targeted than relying on an arbitrary delay.

await page.goto('https://example.com/report', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('#report-ready');
await page.screenshot({ path: 'report.png', fullPage: true });

Use the readiness selector only if the report actually exposes it. For fonts in PDF output, the documented waitForFonts default is true, but the page still needs to have loaded the content and styles the report requires.

Troubleshoot common output problems

The PDF layout differs from the browser

This is often expected: PDF generation uses print media by default. Add await page.emulateMediaType('screen') before page.pdf() if you intend to use screen CSS; otherwise, inspect and correct the report’s print styles.

PDF backgrounds or colors are missing

Set printBackground: true to include background graphics. Puppeteer also modifies PDF colors for printing by default; use print-color CSS when exact authored colors matter, then inspect the rendered PDF.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
HP LaserJet MFP M235sdw All-in-One Laser Wireless Printer, Scan/Copy, Black & White, Duplex, Best-for-Office
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for offices printing, scanning and copying black & white brochures, business documents and presentations. Perfect for 1-5 people
  • FASTEST TWO-SIDED PRINTING IN ITS CLASS – Up to 28 black-and-white pages per minute single-sided. Quickly finish multipage print projects with the fastest in-class two-sided printing speed
  • DUAL-BAND WI-FI WITH SELF-RESET – Automatically detects and resolves connectivity issues
  • STRONG SECURITY – Built-in security features help protect your printer from potential attacks
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Ethernet included. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more.

The PDF has unexpected size or content scaling

Set format, orientation, and margins explicitly. If the report defines CSS @page dimensions, use preferCSSPageSize: true; otherwise Puppeteer scales content to fit the selected paper size.

An element screenshot is blank or fails

Confirm the selector matches an element before calling screenshot(). The element API scrolls a matching element into view if needed, but it cannot capture an element that was never found.

The image or PDF misses late-loading content

Wait for the report’s meaningful ready state, such as a known selector or completed data load, before capturing. A fixed delay can be unreliable when load times vary; tie the wait to the page’s actual rendering behavior where possible.

The script cannot launch a browser

Check the Puppeteer installation and browser setup for your environment against the installation guide. The appropriate remedy depends on how Puppeteer was installed and where the script runs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
HP LaserJet Pro 3101sdw | Monochrome | Laser Printer | All-in-One | Duplex
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black-and-white documents and reports. Print speeds up to 35 ppm black.
  • PROFESSIONAL PRODUCTIVITY – Proficiency with every print—bring your business to life with toner designed for sharp, professional-quality prints
  • UPGRADED FEATURES – Fast printing, scanning and copying, auto 2-sided printing, a 250-sheet input tray and 50-sheet auto document feeder
  • AWARD-WINNING RELIABILITY – Performance you can count on page after page, and always ready for the high demands of business
  • WIRELESS PRINTING – Stay connected with our most dependable Wi-Fi, which looks for the best connection to stay online
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a straightforward URL capture without managing Puppeteer and a local browser, ScreenshotNeo returns an image or PDF from one GET request. Its clean-shot steps accept cookie or consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with response headers identifying the page verdict and billing status. An MCP server provides screenshot tools for AI agents. Free includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

See the ScreenshotNeo API documentation for parameters and response details. Sign up for 1,000 free screenshots a month, with no card required.

Performance, reliability, and cost considerations

The Puppeteer documentation cited here does not establish that screenshots or PDFs are universally faster, smaller, or more reliable. Actual results depend on the page, browser environment, content, and output settings; measure your own workload if those differences determine the implementation.

For recurring reports, make capture failures visible in your own job handling: wait for a meaningful page-ready condition, check that the target element exists when using a selector, and handle browser cleanup in a finally block. Puppeteer’s cited API documentation does not set a per-capture price; operational cost depends on the browser infrastructure and workload you run.

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

Frequently Asked Questions

Can Puppeteer make a PDF that uses screen CSS?

Yes. Call page.emulateMediaType('screen') before page.pdf().

Does fullPage: true create a multi-page PDF?

No. It makes a full-page image. Use page.pdf() for paginated output.

Quick Recap

SaleBestseller No. 2
Canon imageCLASS MF273dw - Monochrome Wireless Laser Printer, Multifunction With Scanner, Copier, Auto Document Feeder, With 1 Year Limited Warranty, 30 PPM, Black
Canon imageCLASS MF273dw - Monochrome Wireless Laser Printer, Multifunction With Scanner, Copier, Auto Document Feeder, With 1 Year Limited Warranty, 30 PPM, Black
Wireless 3-in-1: Print | Copy | Scan; Print up to 30 Pages Per Minute (BW, Letter); First Print Out in Approximately 5.3 Seconds (Letter)
$139.99
Bestseller No. 3
HP Laserjet MFP M140w Wireless Black & White Printer, Print, scan, Copy, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
HP Laserjet MFP M140w Wireless Black & White Printer, Print, scan, Copy, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided; WIRELESS WITH SELF-RESET – Helps you stay connected
$209.00
Bestseller No. 4
HP LaserJet MFP M235sdw All-in-One Laser Wireless Printer, Scan/Copy, Black & White, Duplex, Best-for-Office
HP LaserJet MFP M235sdw All-in-One Laser Wireless Printer, Scan/Copy, Black & White, Duplex, Best-for-Office
DUAL-BAND WI-FI WITH SELF-RESET – Automatically detects and resolves connectivity issues
$179.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.