October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Capture a Full-Page Website Screenshot in Java with Playwright

Use Playwright Java's Page.screenshot with setFullPage(true) to capture a full scrollable page, save it to a file, or process the returned bytes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Playwright for Java, call page.screenshot() with setFullPage(true). Add setPath(Paths.get("full-page.png")) to save the screenshot; without a path, the method returns the image as a byte[] instead.

Capture and save the full page

This complete example launches Chromium, opens a page, and saves the full scrollable document to full-page.png in the current working directory:

import com.microsoft.playwright.*;
import java.nio.file.Paths;

public class FullPageScreenshot {
  public static void main(String[] args) {
    try (Playwright playwright = Playwright.create()) {
      Browser browser = playwright.chromium().launch();
      Page page = browser.newPage();
      page.navigate("https://example.com");
      page.screenshot(new Page.ScreenshotOptions()
          .setPath(Paths.get("full-page.png"))
          .setFullPage(true));
      browser.close();
    }
  }
}

The essential option is setFullPage(true). Playwright defines this as capturing the full scrollable page, rather than just the visible viewport. The option defaults to false. See the Playwright Java Screenshots guide and Page API reference.

Set up Playwright Java

If Playwright is not already installed in your Java project, follow the Java setup steps in the official introduction. The example above uses Chromium as an illustrative browser choice; the full-page option is a page screenshot setting, not a Chromium-only feature. The general sequence is to create the Playwright instance, launch a browser, create a page, navigate to a URL, and capture the screenshot.

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.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Save an image or work with its bytes

Write the capture to disk

Pass a path using setPath. A relative path is resolved from the Java process’s current working directory. When a path is supplied, Playwright infers the screenshot format from the file extension; the API reference documents PNG, JPEG, and WebP.

Keep the screenshot in memory

Omit the path to receive the screenshot bytes without saving a file. For example, to encode the returned bytes as Base64:

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
import java.util.Base64;

byte[] buffer = page.screenshot(new Page.ScreenshotOptions()
    .setFullPage(true));
String encoded = Base64.getEncoder().encodeToString(buffer);
System.out.println(encoded);

The API returns byte[], so you can also pass it to your own storage or image-processing code. The required page here is the same Playwright Page created and navigated in the first example.

Choose screenshot options for your output

  • setFullPage(true) captures the full scrollable page; the default is viewport-only capture.
  • setPath(Path) writes the image to disk. The filename extension determines the format when a path is provided.
  • setType(...) selects PNG, JPEG, or WebP where supported by the installed Playwright version.
  • setScale(ScreenshotScale.CSS) produces one image pixel per CSS pixel. ScreenshotScale.DEVICE uses device pixels and is the documented default; on high-DPI displays it can produce a larger image.
  • setQuality(int) sets quality from 0 to 100 for JPEG and WebP. It does not apply to PNG.
  • setTimeout(double) sets the screenshot operation timeout. The documented default is 30 seconds; setting it to 0 disables the timeout.
  • setStyle(String) injects CSS while the screenshot is taken. The injected styles also apply through Shadow DOM and inner frames, which can help hide dynamic elements or make captures more repeatable.
  • setMask(...) masks selected locators in the screenshot.

Check the Page API reference for the exact option types and availability in your installed version. To reduce output size, consider JPEG or WebP with an appropriate quality setting; for lossless output, use PNG. Device-pixel scale can increase the resulting dimensions and file size compared with CSS-pixel scale.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Full-page screenshots versus element screenshots

Use Page.screenshot with setFullPage(true) when you want the page’s full scrollable document. Use Locator.screenshot when you want an image of a matched element instead. A screenshot of a scrollable element includes only the content currently scrolled into view within that element; see the Locator API reference. The screenshots guide also documents locator screenshots.

What full-page capture does—and does not—ensure

Full-page mode asks Playwright to capture the full scrollable page; it does not establish that a particular website has exposed every deferred or interaction-triggered item before capture. If the site loads content only after scrolling, clicking, or waiting, perform the necessary interactions or waits before taking the screenshot. A successful capture reflects the page state at capture time.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

Troubleshooting

  • The image shows only the viewport: confirm the call includes .setFullPage(true) on Page.ScreenshotOptions, rather than using the default screenshot options.
  • No file appears: make sure setPath(Paths.get("full-page.png")) is present, and check the Java process’s current working directory. Without a path, use the returned byte[]; Playwright does not save it automatically.
  • The capture times out: the screenshot timeout defaults to 30 seconds. Review whether the page is ready for capture; if a longer limit is appropriate, set a larger timeout. A value of 0 disables the screenshot timeout.
  • Content is missing from the bottom: full-page mode captures the scrollable page state, but does not guarantee that deferred content has loaded. Trigger the site’s required scrolling or interaction and wait for the content before capturing.
  • The output is unexpectedly large: device scale uses device pixels and can increase dimensions on high-DPI displays. Consider CSS scale, or a compressed format such as JPEG or WebP with a suitable quality value.
  • A targeted element screenshot omits part of a scroll area: locator screenshots include only the currently scrolled content of a scrollable element. Use a page-level full-page screenshot if you need the document rather than that element’s visible portion.
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 is a website screenshot API and MCP server. A single GET request returns an image or PDF, without launching and managing a browser in your Java application. It accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response reports the page verdict and billing status in headers. Its MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo documentation.

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

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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

Frequently Asked Questions

Does setFullPage(true) change the browser viewport size?

It requests a screenshot of the full scrollable page; it is not a command to resize the browser window.

Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

Can I use this method to save a PDF?

The example uses Page.screenshot to return image bytes or save an image. The supplied Java screenshot API details do not establish a PDF workflow.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.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.

Leave a Reply

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

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.

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.