Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk3 min

Puppeteer Full-Page Screenshot on Windows: Set the Viewport and Output Path

Use Puppeteer’s setViewport and fullPage options to capture an entire page on Windows, then save it to a path resolved from Node’s working directory.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the viewport with page.setViewport({ width, height }), then capture with page.screenshot({ fullPage: true, path }). In Puppeteer, fullPage extends the capture to the full page; the viewport dimensions still define the page’s viewport. A relative screenshot path is resolved from the Node.js process’s current working directory—not automatically from the script’s folder.

Capture a full page at a chosen viewport

Set the viewport before navigation, as Puppeteer recommends. This gives the page the intended viewport dimensions while it loads; in some cases, changing viewport-related properties can cause a page reload. The example uses a relative output path, so the file is written beneath the process’s current working directory.

As an Amazon Associate I earn from qualifying purchases.

const puppeteer = require('puppeteer');

async function main() {
  const browser = await puppeteer.launch();

  try {
    const page = await browser.newPage();

    await page.setViewport({ width: 1280, height: 800 });
    await page.goto('https://example.com');

    await page.screenshot({
      fullPage: true,
      path: 'screenshots/full-page.png',
    });
  } finally {
    await browser.close();
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Install Puppeteer in the project first if it is not already installed. The example assumes the screenshots directory exists and is writable. Puppeteer’s screenshot API does not promise to create missing directories.

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

Choose the viewport and capture extent separately

  • Viewport: page.setViewport({ width, height }) sets the page’s viewport in CSS pixels. Puppeteer recommends setting it before navigation. Its documented default viewport is 800 by 600 unless configured otherwise.
  • Capture extent: fullPage: true requests a screenshot of the whole page rather than only the visible viewport. The default is false.
  • Output file: path names the file to save. When omitted, Puppeteer does not save the screenshot to disk. If a path is supplied, Puppeteer infers the image format from its extension; use an extension such as .png or .jpg that matches the format you want.

For example, a viewport of 1280 by 800 means the page is rendered with that viewport size, while fullPage: true asks Puppeteer to include content beyond the initially visible 800-pixel viewport height. A tall screenshot does not mean the viewport itself was set to the full document height.

#1 Best Overall

Set the output path on Windows

Relative path

With path: 'screenshots/full-page.png', the location is relative to the Node.js process’s current working directory. That directory depends on how the project starts Node; it is not guaranteed to be the directory containing the script. Ensure the destination directory exists and the process can write there.

Absolute path

To save to a specific location, pass an absolute path appropriate for your Windows project. Node’s path utilities can help construct paths without manually relying on a particular string-literal style:

Rank #2
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.
const path = require('node:path');

const outputPath = path.resolve('screenshots', 'full-page.png');
await page.screenshot({ fullPage: true, path: outputPath });

path.resolve starts from the process’s current working directory when given relative segments. Check the resulting destination in your own project setup. Puppeteer’s screenshot documentation does not establish Windows-specific path-literal conventions, choose a drive location for you, create missing folders, or guarantee filesystem permissions.

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

Common problems and fixes

  • The screenshot is only the visible portion: Confirm that the screenshot options include fullPage: true. Its default is false.
  • The image dimensions are not what you expected: Set the intended width and height with page.setViewport before navigation. Remember that these values control the viewport, not the full-page capture extent.
  • The file is missing or appears in an unexpected folder: Resolve the relative path against the process’s current working directory. Log process.cwd() while diagnosing, or supply a verified absolute destination.
  • Saving fails for a path: Verify that the parent directory exists and is writable. The Puppeteer API reference does not promise automatic directory creation.
  • The file type is unexpected: When saving with path, use the intended extension because Puppeteer infers the screenshot type from it.

Or skip the browser setup

ScreenshotNeo provides a screenshot API and MCP server for developers. One GET request can return a screenshot or PDF. For a basic screenshot of the example page:

Rank #3
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage | LPDDR4 RAM, 180° Lay-Flat, Dual-Band WiFi, Type-C PD Fast Charging, Thin & Lightweight for Students, Home & Office, Gray
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
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 options. ScreenshotNeo removes cookie banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 screenshots. Sign up for free.

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

Frequently Asked Questions

Can I use a different viewport for each page?

Yes. Set the viewport on the page you are about to capture with `page.setViewport({ width, height })`.

Does `fullPage: true` change the viewport size?

No. It changes the requested capture extent; `setViewport` controls the viewport dimensions.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.