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.
Recommended Free Tools
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: truerequests a screenshot of the whole page rather than only the visible viewport. The default isfalse. - Output file:
pathnames 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.pngor.jpgthat 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
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
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
- 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.
Common problems and fixes
- The screenshot is only the visible portion: Confirm that the screenshot options include
fullPage: true. Its default isfalse. - The image dimensions are not what you expected: Set the intended width and height with
page.setViewportbefore 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
- 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.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.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Quick Recap
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.




