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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

For a Spring Boot service, the most practical default is Playwright Java: navigate Chromium to the page, wait for the page’s actual readiness condition, then call page.screenshot() with setFullPage(true). Spring Boot should handle the HTTP or job interface; a separate screenshot service should own browser work, resource limits and cleanup.

This captures the page’s full scrollable document rather than only the visible viewport. It does not, by itself, guarantee that lazy-loaded content, fonts, charts or animations are ready. Those need to be handled explicitly before capture.

Use Playwright Java for the screenshot layer

Playwright’s full-page option captures a scrollable page as though it were displayed on a screen tall enough to show the whole document. In Java, the core call is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
byte[] image = page.screenshot(new Page.ScreenshotOptions()
    .setPath(Paths.get("screenshot.png"))
    .setFullPage(true));

The returned value is the screenshot bytes, so writing to a path is optional: omit setPath when the application will stream the bytes or store them elsewhere. The browser automation layer should manage Chromium startup, page creation, navigation, readiness checks, capture and cleanup. Keep those responsibilities out of the Spring controller.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Playwright’s documentation describes a full-page screenshot as a capture of the full scrollable page, “as if you had a very tall screen and the page could fit it entirely.”

Build the Spring Boot capture flow

A robust endpoint has more work to do than call the screenshot method. Treat a requested URL as untrusted input, authorize the capture, establish a bounded browser workload, wait for the right content, then return or persist the result.

  1. Accept a target. Prefer an internal route identifier if callers do not need arbitrary URLs. Validate and authorize every target.
  2. Apply destination controls. Defend against server-side request forgery (SSRF), restrict destinations, and limit redirects. Do not expose an unauthenticated public endpoint that can navigate to arbitrary addresses or internal services.
  3. Allocate an isolated page or context. Reuse a managed browser process where appropriate, but use an isolated browser context or page for each capture. Supply required cookies or storage state for authenticated pages without putting secrets in URLs or logs.
  4. Navigate with a deliberate timeout. Choose a timeout appropriate to your service and report navigation failures as bounded errors.
  5. Wait for application readiness. Use a stable selector, a suitable network-idle policy, completed images and fonts, or an application-specific JavaScript marker. Do not equate a completed navigation with a fully rendered page.
  6. Capture the full page. Use setFullPage(true); disable or freeze animations if the output needs visual consistency.
  7. Deliver the result. Return bytes with the matching content type, or save the image to object storage and return an identifier.
  8. Clean up and enforce limits. Close the page and context even after errors, and enforce concurrency, memory and total-request limits.

Service and controller responsibilities

A controller can delegate to a singleton screenshot service, but the service should own the blocking browser operation. This endpoint shape returns PNG bytes; validation and authorization are shown as responsibilities rather than omitted production safeguards.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@RestController
@RequestMapping("/screenshots")
class ScreenshotController {
  private final ScreenshotService screenshots;

  ScreenshotController(ScreenshotService screenshots) {
    this.screenshots = screenshots;
  }

  @GetMapping(produces = MediaType.IMAGE_PNG_VALUE)
  ResponseEntity<byte[]> capture(@RequestParam URI target) {
    // Validate and authorize target before invoking the capture service.
    byte[] png = screenshots.capture(target);
    return ResponseEntity.ok()
        .contentType(MediaType.IMAGE_PNG)
        .body(png);
  }
}

The core of the service should use the Playwright Java API and close per-capture resources in a finally path. The following shows the capture operation; browser creation and application shutdown belong in managed service lifecycle code rather than in each controller call.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
byte[] capture(Page page, URI target) {
  page.navigate(target.toString(), new Page.NavigateOptions()
      .setTimeout(30_000));

  // Replace this with the page's real readiness condition.
  page.waitForLoadState(LoadState.DOMCONTENTLOADED);

  return page.screenshot(new Page.ScreenshotOptions()
      .setFullPage(true));
}

The example uses a navigation timeout and a basic document-loaded checkpoint to make the sequence concrete; neither is a universal readiness guarantee. In an application with a known completion marker, wait for that marker instead. Close the page/context in a finally block around the full operation, and shut down the managed browser when the Spring application terminates.

Make full-page output complete and consistent

Lazy-loaded sections, images and fonts

A screenshot can faithfully capture an incomplete page. Sites often load images only as they approach the viewport; a full-page capture does not guarantee that every such image has loaded. Wait for a page-specific ready selector or marker, or use an application-appropriate image and font completion check before capture. Avoid treating network idle as universally correct: pages that keep requests open or update continuously may never reach it.

Charts and animation

Charts may render after the initial document load, and animations can leave a capture at an arbitrary frame. Wait for the application’s chart-ready signal when available. Disable or freeze animation when consistency matters, and make that choice explicit because it can alter what the page displays.

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

Authentication and browser rendering

For authenticated pages, create a context with the necessary cookies or storage state. Do not log those credentials or expose them in screenshot URLs. Let the browser render the target normally: fetching HTML on the server is not a substitute for browser behavior, cross-origin resources or content policies such as CSP.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Choose output format and delivery deliberately

The example returns PNG, which is appropriate when a lossless image is wanted. For smaller output, choose JPEG or WebP where supported by the capture path and set the response content type to match the bytes. For a large capture, consider persisting to object storage and returning a reference rather than holding the image in an HTTP response. A full-page image can be tall and memory-intensive; set a maximum capture height or byte-size policy when the use case permits.

There is no universal latency, memory requirement or safe maximum page height for this workload. Those depend on the pages and the browser/runtime versions in your deployment. Benchmark representative pages in that environment, then set limits and queue capacity based on observed resource use.

Control load and failures in production

  • Bound concurrency. Each capture can consume a browser page, network bandwidth, CPU and memory. Use a bounded executor or queue rather than allowing incoming requests to create unbounded browser work.
  • Protect reactive applications. Playwright calls are blocking. If the application uses WebFlux, isolate them on a bounded scheduler rather than running them on event-loop threads.
  • Make errors observable. Distinguish navigation timeouts, browser crashes and screenshot failures, and return bounded, useful errors to callers.
  • Retry carefully. Retry only idempotent captures and cap retries. A retry policy should not turn a failing target into an unbounded queue of browser jobs.
  • Close resources. Ensure pages and contexts close on success and failure, and shut down the browser as part of application termination.

Playwright Java or direct Chrome DevTools Protocol?

Consideration Playwright Java Direct CDP
Abstraction High-level browser and page API Low-level Chromium protocol
Full-page control setFullPage(true) captureBeyondViewport on Page.captureScreenshot
Browser setup Playwright-managed Chromium and contexts Useful when a Chromium connection is already managed or protocol-level control is needed
Browser scope Playwright-supported browser engines and Java bindings Chromium-focused
Maintenance trade-off Library handles many browser details Your code tracks protocol behavior and version changes
Good fit Most Spring Boot screenshot services Advanced Chromium-specific integrations

CDP’s Page.captureScreenshot has a captureBeyondViewport parameter that controls whether content beyond the viewport is included; it defaults to false. CDP also exposes image format and quality parameters. The protocol overview warns that the tip-of-tree protocol changes frequently and does not guarantee backward compatibility, so direct CDP makes sense when its lower-level control is worth the additional version-coupling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common capture problems

The image contains only the visible viewport

Confirm that the screenshot options include setFullPage(true). If using direct CDP instead, check that captureBeyondViewport is enabled rather than relying on its default.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Images or sections are missing

The capture likely ran before lazy content or application rendering completed. Replace a generic load checkpoint with a stable selector or application-specific readiness signal, and verify image/font completion where relevant.

The screenshot is inconsistent between runs

Dynamic content, animation, fonts, charts or authentication state may differ. Use a stable readiness marker, freeze animations if suitable, and make sure the capture context has the expected cookies or storage state.

The request times out or the browser crashes

Keep navigation timeouts explicit, bound concurrent work and expose failures as observable service errors. Inspect whether the target remains busy or the capture is too large for the configured resource limits; cap retries and avoid unbounded request accumulation.

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

The endpoint can reach an unintended destination

Treat caller-supplied URLs as an SSRF risk. Validate and authorize targets, restrict destination hosts and redirects, and avoid offering unrestricted arbitrary-URL capture on a public endpoint.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Or skip the browser setup

If the job is simply to obtain a rendered screenshot and you do not need the browser to run inside your Spring Boot deployment, ScreenshotNeo is a hosted screenshot API. One GET request returns an image or PDF; consult the API documentation for request options and response behavior.

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

Its clean-shot flow accepts cookie or consent banners like a visitor and removes known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits cost nothing, and responses say which outcome occurred in the X-Page-Verdict and X-Billed headers. An MCP server offers take_screenshot, get_page_info and capture_pdf tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. For a Spring Boot integration, call the API from your application and handle its returned response; it does not replace a local Playwright browser when local rendering, browser state or custom automation is required.

Sign up for 1,000 free screenshots a month with no card.

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

Frequently Asked Questions

Can I take a screenshot of an authenticated page?

Yes. Create the browser context with the page’s required cookies or storage state, and keep credentials out of URLs and logs.

Does full-page mode capture an infinite-scrolling feed in full?

Not necessarily. Full-page capture covers the scrollable document available to the browser at capture time; it does not guarantee that a site has loaded content that appears only after additional scrolling or interaction.

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.