Free tools Windows power users keep installed
One-click scans. No signup required.
In a Spring Boot app, call a screenshot API like any other HTTP service: send the provider’s documented request and credentials, then handle the response as image bytes or a response entity. For a synchronous Spring MVC application, RestClient is a straightforward fit; use WebClient when your application needs its non-blocking, reactive model. The request fields and response format vary by provider. The example below uses ScreenshotNeo’s documented GET endpoint, while a Playwright Java example shows the alternative of running browser automation yourself.
Choose between a hosted API and running a browser yourself
A hosted screenshot API performs the rendering outside your application. Your Spring service sends a request containing the page URL and any provider-specific options, then receives the rendered result. This avoids managing the browser runtime in your deployment, but makes the provider’s request contract, limits, latency, reliability, data handling, and availability important due-diligence questions.
With Playwright Java, your application controls browser automation and captures the page directly. That gives your team control over the rendering workflow, but your team also takes responsibility for browser installation, runtime operation, concurrency, and maintenance. The documented screenshot capabilities do not establish a general cost, speed, or resource-use advantage for either approach.
For the Spring HTTP layer, choose based on the application’s execution model: Spring describes RestClient as synchronous and fluent, and WebClient as non-blocking and reactive. Do not choose a reactive client solely because the application uses Spring Boot. Spring Framework 7.0’s reference marks RestTemplate as deprecated in favor of RestClient; check the documentation for the Spring Framework version used by your application.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated 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 match#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Call a screenshot API with Spring RestClient
The Java example uses ScreenshotNeo’s GET endpoint and API-key query parameter. Keep the key outside source control, and use the provider’s own current documentation if you switch services: screenshot APIs do not share a universal endpoint, credential scheme, parameter set, or response contract.
1. Configure the endpoint and key outside your code
For example, put these settings in an environment-specific Spring configuration file, with the secret injected from your deployment environment or secret manager:
screenshot.api-url=https://api.screenshotneo.com/v1/shot
screenshot.api-key=${SCREENSHOT_API_KEY}
Set SCREENSHOT_API_KEY in the environment where the app runs. Do not commit a real key to a repository or expose it in client-side code.
2. Create a configured RestClient
This example targets Java applications whose Spring version provides RestClient. Inject the configured URL and key using Spring configuration:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;
@Configuration
class ScreenshotClientConfiguration {
@Bean
RestClient screenshotRestClient(
RestClient.Builder builder,
@Value("${screenshot.api-url}") String apiUrl,
@Value("${screenshot.api-key}") String apiKey) {
return builder
.baseUrl(apiUrl)
.defaultQueryParam("access_key", apiKey)
.build();
}
}
If your project’s Spring version does not provide RestClient, use the HTTP client supported by that version or upgrade deliberately; do not assume the Framework 7.0 reference applies unchanged to every Spring Boot release.
3. Request and handle the screenshot bytes
A service can request a URL and save the response body. This example asks for WebP output using ScreenshotNeo’s format parameter, and writes only after checking that the response contains a body:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.springframework.http.HttpStatusCode;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;
@Service
class ScreenshotService {
private final RestClient client;
ScreenshotService(RestClient screenshotRestClient) {
this.client = screenshotRestClient;
}
public Path capture(String pageUrl, Path output) throws IOException {
byte[] image = client.get()
.uri(uriBuilder -> uriBuilder
.queryParam("url", pageUrl)
.queryParam("format", "webp")
.build())
.retrieve()
.onStatus(HttpStatusCode::isError, (request, response) -> {
throw new IllegalStateException(
"Screenshot API returned HTTP " + response.getStatusCode());
})
.body(byte[].class);
if (image == null || image.length == 0) {
throw new IllegalStateException("Screenshot API returned an empty body");
}
Files.write(output, image);
return output;
}
}
Use an application-generated or otherwise validated destination path rather than letting an untrusted caller choose arbitrary filesystem paths. If the image is meant to be returned from a controller, you can pass the bytes through an appropriate response body instead of saving them. For more control over status and headers, use toEntity(byte[].class) to receive a ResponseEntity; Spring documents response conversion, headers, URI construction, and status handling in its REST client reference.
4. Set timeouts and size limits for your workload
A screenshot may take longer than a typical small JSON request, and an image can consume significant memory. Configure connection and response timeouts on the underlying HTTP request factory according to your app’s latency budget, and cap the maximum response size at the infrastructure or HTTP-client layer where possible. The appropriate values depend on your pages, traffic, and provider; there is no universal timeout or image-size limit established here. Avoid retrying indefinitely: retries can amplify load and may repeat a costly or slow render.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Use WebClient for reactive applications
If your application already uses reactive processing, WebClient can keep the outbound request non-blocking. The following shows the shape of a request; configure a bounded-memory strategy and timeouts appropriate to the expected image sizes in your application:
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
class ReactiveScreenshotService {
private final WebClient client;
ReactiveScreenshotService(WebClient.Builder builder, String apiUrl, String apiKey) {
this.client = builder
.baseUrl(apiUrl)
.defaultUriVariables(java.util.Map.of("access_key", apiKey))
.build();
}
Mono<byte[]> capture(String pageUrl) {
return client.get()
.uri(uriBuilder -> uriBuilder
.queryParam("access_key", "{access_key}")
.queryParam("url", pageUrl)
.queryParam("format", "webp")
.build())
.accept(MediaType.APPLICATION_OCTET_STREAM)
.retrieve()
.bodyToMono(byte[].class)
.filter(bytes -> bytes.length > 0)
.switchIfEmpty(Mono.error(
new IllegalStateException("Screenshot API returned an empty body")));
}
}
This example illustrates reactive response handling, but query-string credentials may be logged by intermediaries or application diagnostics. Prefer an authorization header if the selected provider supports one; otherwise ensure URLs and query strings are not recorded in logs. For a fully production-ready client, also define status-specific error mapping, timeout behavior, and response-size controls.
Capture screenshots with Playwright Java instead
Playwright Java is the DIY path when your team wants the application to control a browser. Its screenshot API can save to a file, return bytes for further processing, capture a full page, or target a locator. The snippet below assumes Playwright and a browser runtime are installed as part of your application environment; it is not a call to a hosted screenshot endpoint.
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.BrowserType;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import java.nio.file.Paths;
public class BrowserScreenshot {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch(
new BrowserType.LaunchOptions().setHeadless(true));
try {
Page page = browser.newPage();
page.navigate("https://example.com");
page.screenshot(new Page.ScreenshotOptions()
.setPath(Paths.get("page.png"))
.setFullPage(true));
} finally {
browser.close();
}
}
}
}
To work with bytes instead of a file, call page.screenshot() and pass the returned byte array to your storage or response code. To capture a specific element, use a locator’s screenshot method. Review the Playwright Java screenshot documentation and your deployment requirements before adopting this path: browser binaries, process lifecycle, and resource capacity become your responsibility.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Or skip the browser setup
Use ScreenshotNeo’s documented endpoint directly from Spring; the same request contract and available options are in the ScreenshotNeo API documentation.
import org.springframework.web.client.RestClient;
RestClient client = RestClient.create();
byte[] shot = client.get()
.uri("https://api.screenshotneo.com/v1/shot?access_key={key}&url={url}",
apiKey, "https://stripe.com")
.retrieve()
.body(byte[].class);
- Cookie and consent banners, newsletter popups, and chat widgets are removed before the capture; each cleanup step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. The response identifies page verdict and billing status in headers.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents and MCP clients. - The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try the API.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Check these India-specific points before sending URLs
The available provider documentation does not establish service availability in India, data residency, retention period, local support, pricing in INR, or regulatory status for Indian customers. Verify these terms directly with the provider before sending sensitive URLs or data. Also check whether pages require authentication, contain personal information, or are permitted to be captured under your organization’s policies.
For any hosted provider, confirm the exact HTTP method, endpoint, authentication method, required parameters, output encoding, quota and pricing, response size limits, error behavior, processing location, retention, and support terms. A provider’s example request is not a universal screenshot API schema.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshooting common integration failures
- 401 or 403 response: Check that the key is present in the expected environment and that you are using the provider’s documented credential method. Do not assume every provider accepts a query parameter or an authorization header.
- 400 response: Validate the URL encoding and required parameters against that endpoint’s documentation. Screenshot services may use different parameter names and output-format values.
- Timeout: Confirm the target page is reachable from the service, then review client and provider timeouts. If the page depends on slow scripts or assets, use provider-supported wait settings where available; do not set retries without a cap.
- Empty or unreadable output: Inspect the HTTP status and response headers before writing bytes as an image. An error response is not a valid image even if code attempted to treat it as one.
- Memory pressure: Avoid retaining many large byte arrays at once. Stream or persist results as appropriate, bound concurrency, and enforce practical response-size limits.
- Browser launch failure with Playwright: Verify that the browser runtime is installed and compatible with the Playwright version in the deployment image, and that the process has required operating-system dependencies and permissions.
Plan for performance, reliability, and cost
For a hosted API, request latency includes remote rendering and network transit; measure it in the actual deployment region and against representative pages before setting service-level expectations. Handle provider errors explicitly, apply bounded timeouts, and decide whether a failed capture should fail the user request, be queued, or be retried later. ScreenshotNeo exposes verdict and billing headers, which can help distinguish outcomes; other providers may expose different diagnostics.
For Playwright, capacity depends on the pages and concurrency you run. Benchmark in your own deployment rather than assuming browser automation is cheaper or faster than outsourcing. Limit simultaneous browser work, recycle browser processes according to your operational needs, and monitor memory and CPU. The documented material establishes capture features, not comparative performance figures.
Frequently Asked Questions
Can I use a screenshot API from a Spring Boot controller?
Yes. Call it from a service layer and return or store the resulting bytes; avoid making a slow render block a latency-sensitive request unless that behavior is intentional.
Does using a screenshot API mean the page is hosted in India?
No such conclusion follows from the endpoint alone. Ask the provider to confirm processing location, retention, and availability for your specific account and use case.
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.

