Free tools Windows power users keep installed
One-click scans. No signup required.
Use page.pdf() to save a web page as a paginated PDF; use page.screenshot() to save it as an image. They are separate Playwright APIs, so a full-page screenshot does not itself create a PDF. Playwright’s PDF output uses print CSS by default; switch to screen media first if you want the page’s screen styles.
Choose PDF or image output
| What you need | Playwright method | What it creates |
|---|---|---|
| A printable document | page.pdf() |
A paginated PDF, using print CSS media by default. Playwright Page API |
| A viewport or full-page capture | page.screenshot() |
An image such as PNG, JPEG, or WebP. Use fullPage: true to capture the full scrollable page. Playwright Screenshots guide |
| Repeatable visual regression evidence | Playwright Test’s expect(page).toHaveScreenshot() |
A screenshot assertion against a baseline image; it is not a PDF export. Playwright Visual comparisons guide |
Set up a runnable Node.js example
The example below uses Playwright’s Node.js API. Install Playwright in your project and install its browser before running the script:
As an Amazon Associate I earn from qualifying purchases.
- Run
npm init -yif the directory does not already have a package manifest. - Run
npm install playwright. - Run
npx playwright install chromiumto install the browser used below. - Save the script as
save-page.js, then runnode save-page.js.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
try {
await page.goto('https://example.com', { waitUntil: 'networkidle' });
// Full scrollable page as a PNG image.
await page.screenshot({ path: 'page.png', fullPage: true });
// Paginated PDF, laid out using print CSS by default.
await page.pdf({
path: 'page.pdf',
format: 'A4',
printBackground: true
});
// For a PDF rendered with screen CSS instead, emulate screen media
// before calling page.pdf().
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'page-screen.pdf', printBackground: true });
} finally {
await browser.close();
}
})();
Replace https://example.com with the page you need. The script writes page.png, page.pdf, and page-screen.pdf to the current directory. The navigation wait shown is an example, not a guarantee that every site has finished rendering; pages with delayed or continuously active requests may need a more specific readiness condition.
Save a full-page screenshot as an image
To capture the entire scrollable document in one image, set fullPage: true:
#1 Best Overall
await page.screenshot({ path: 'full-page.png', fullPage: true });
Without that option, the screenshot covers the current viewport. A full-page capture remains an image; it does not paginate the page or produce a PDF.
Choose image type and resolution
Playwright supports PNG, JPEG, and WebP screenshot output. The documented screenshot options also include clipping a region, setting JPEG or WebP quality, and choosing between CSS-pixel and device-pixel scale. With scale: 'css', the output uses one image pixel per CSS pixel; scale: 'device' uses device pixels and may create a larger image on a high-DPI display. Check the installed version’s Page API reference for the accepted options and defaults.
Rank #2
Save a web page as a PDF
Call page.pdf() after navigation. Supplying path writes the PDF to disk; without a path, the method returns a PDF buffer that your application can save or process.
await page.pdf({ path: 'page.pdf' });
Set page size, margins, and page ranges
Use format for a named paper size such as 'A4', or set width and height directly. Unlabeled width and height values are interpreted as pixels; supported units include px, in, cm, and mm. The PDF options also include margins, page ranges, scale, and preferCSSPageSize.
await page.pdf({
path: 'selected-pages.pdf',
format: 'A4',
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
pageRanges: '1-3',
printBackground: true
});
Set preferCSSPageSize: true when the page’s CSS @page size should take priority over a size set through format, width, or height. Consult the Page API documentation for the complete PDF option list.
Control PDF media and colors
PDF generation uses print CSS media by default. Print styles can change layout, omit elements, or use different colors from the screen version. To render with screen media, call page.emulateMedia({ media: 'screen' }) before page.pdf():
Rank #4
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'screen-style.pdf', printBackground: true });
These are separate controls: printBackground: true enables background graphics, while the CSS property -webkit-print-color-adjust can be used to force exact colors when print color adjustment changes them. Inspect the resulting PDF, especially if the site has an intentional print stylesheet.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchMake visual regression screenshots more stable
Screenshot output can vary with the host operating system, browser version, browser settings, hardware, power source, and headless mode. Playwright recommends generating and comparing visual baselines in the same environment. Its toHaveScreenshot() assertion waits for consecutive screenshots to match before comparing with the expectation; it does not turn a page into a PDF. See the Visual comparisons guide for the assertion workflow.
- Keep the browser version and host environment aligned between baseline generation and comparison.
- Use the same relevant browser settings and capture mode for both runs.
- When a test changes unexpectedly, check for environment differences before treating the image change as a product regression.
Troubleshoot common output problems
| Symptom | Likely cause | What to do |
|---|---|---|
| The PDF does not look like the screen page. | page.pdf() renders with print CSS by default. |
Call page.emulateMedia({ media: 'screen' }) before generating the PDF, then inspect the output. |
| PDF backgrounds or colors are missing or changed. | Background graphics are not enabled, or print color adjustment and print CSS affect rendering. | Set printBackground: true for background graphics. Check print styles and consider -webkit-print-color-adjust when exact colors are needed. |
| The screenshot contains only the visible portion. | The screenshot call did not request a full-page capture. | Set fullPage: true in page.screenshot(). |
| A visual screenshot test differs across machines. | The rendering environment may differ in OS, browser version, settings, hardware, power source, or headless mode. | Align the baseline and comparison environments, then review the changed image. |
| The PDF uses an unexpected paper size. | The page’s CSS @page size may take precedence, or the configured format and dimensions may not match the intended output. |
Review format, width, and height; use preferCSSPageSize: true only when the CSS page size should take priority. |
Or skip the browser setup
If you need a screenshot or PDF without launching Playwright and managing a browser in your own code, ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; its options include full-page capture and PDF paper settings.
For example, save a PDF of a page with cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o page.pdf
See the ScreenshotNeo documentation for API parameters and output options. ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month, with no card required.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Frequently Asked Questions
Does page.screenshot() save a PDF?
No. It creates an image; use page.pdf() for a paginated PDF.
Can I keep a PDF’s output in memory instead of saving a file?
Yes. Omit the path option from page.pdf() to receive a PDF buffer.
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.




