Screenshotlayer PDF Capture: Can You Convert a Webpage to PDF with the API?
Screenshotlayer’s accessible docs describe image screenshots, not verified PDF output. Here’s the documented API workflow and how to create a real PDF instead.
Short answer: Screenshotlayer’s accessible documentation does not verify direct PDF output. It documents webpage screenshots in PNG, JPEG, or GIF. Those image formats are not PDFs. The current detailed documentation page redirects to APILayer docs that could not be retrieved during research, so newer PDF support remains possible but unconfirmed. Check the current vendor documentation or ask Screenshotlayer support before relying on PDF output.
If you need a documented Screenshotlayer workflow, use its capture endpoint to save an image. If you need an actual PDF, use a browser’s print-to-PDF capability or a service whose documentation explicitly supports PDF. This guide shows both paths and explains the boundary between them.
1. What Screenshotlayer documents
The archived API specification gives the endpoint as http://api.screenshotlayer.com/api/capture. A request needs an access_key and a complete target url, including https:// or http://. The official FAQ lists PNG as the default image format, with JPEG and GIF also available. It does not establish a PDF format.
The specification is archived and may be stale. The vendor FAQ is accessible, but the current detailed documentation redirect could not be checked. Treat the absence of a PDF parameter in the accessible sources as an evidence limit, not proof that Screenshotlayer can never support PDF.
| Need | What the accessible sources support |
|---|---|
| Capture a webpage image | Yes: PNG, JPEG, or GIF per the FAQ |
| Capture a full page | fullpage=1 in the archived specification |
| Return a PDF directly | Not verified by the accessible docs |
| Create a PDF from a captured image | Possible with a separate image-to-PDF step, but it is a page-sized image inside a PDF, not browser print layout |
2. Make a documented Screenshotlayer image capture
Obtain an access key from the vendor account dashboard. Use HTTPS if your account supports it; the archived specification says paid customers may connect over HTTPS. Do not put the key in client-side browser code or commit it to source control.
cURL
curl -G "http://api.screenshotlayer.com/api/capture" \
--data-urlencode "access_key=YOUR_ACCESS_KEY" \
--data-urlencode "url=https://example.com" \
--data-urlencode "format=PNG" \
-o page.png
This saves the response as an image. Change format to the documented JPEG or GIF option if needed. Do not rename the output to .pdf; changing a filename extension does not convert the file.
Python
import requests
endpoint = "http://api.screenshotlayer.com/api/capture"
params = {
"access_key": "YOUR_ACCESS_KEY",
"url": "https://example.com",
"format": "PNG",
}
response = requests.get(endpoint, params=params, timeout=90)
response.raise_for_status()
content_type = response.headers.get("Content-Type", "")
if "image" not in content_type.lower():
raise RuntimeError(
f"Expected an image response, received {content_type!r}: "
f"{response.text[:500]}"
)
with open("page.png", "wb") as image_file:
image_file.write(response.content)
Node.js
const endpoint = new URL("http://api.screenshotlayer.com/api/capture");
endpoint.search = new URLSearchParams({
access_key: "YOUR_ACCESS_KEY",
url: "https://example.com",
format: "PNG",
});
const response = await fetch(endpoint);
if (!response.ok) {
throw new Error(`Screenshotlayer returned HTTP ${response.status}`);
}
const contentType = response.headers.get("content-type") || "";
if (!contentType.toLowerCase().startsWith("image/")) {
const body = await response.text();
throw new Error(`Expected an image, got ${contentType}: ${body.slice(0, 500)}`);
}
const bytes = new Uint8Array(await response.arrayBuffer());
await (await import("node:fs/promises")).writeFile("page.png", bytes);
These examples intentionally target the documented image capture API. Confirm the endpoint scheme and current parameters in vendor documentation for your account before production use.
3. Documented capture options
The archived API specification and FAQ describe the following controls. Because the specification was archived in 2024, confirm current support and accepted values with the vendor before depending on an option.
| Parameter | Purpose | Practical notes |
|---|---|---|
fullpage=1 |
Capture the full page height | Long pages can produce large image files and take longer to render. |
width |
Set thumbnail width | Use when a reduced-width preview is sufficient. |
viewport |
Set target viewport dimensions | The specification lists 1440×900 as the default. |
format |
Select PNG, JPEG, or GIF | PNG is the documented default; none of these is PDF. |
delay |
Wait before capture | Can allow animations or effects time to load; long waits add latency. |
ttl |
Set cache lifetime | The documented default is 2,592,000 seconds (30 days). |
force=1 |
Request a fresh capture | Use when a cached result may be stale; confirm current cache behavior. |
css_url |
Apply a stylesheet by URL | Ensure the stylesheet is reachable by the capture service. |
user_agent |
Set the browser user agent | Useful when the target varies by user agent. |
accept_lang |
Set the accepted language | Useful for localized pages. |
placeholder |
Configure placeholder behavior | Consult current docs for exact semantics and accepted values. |
secret_key |
Provide the optional secret key parameter | Use only as described by current vendor documentation. |
export |
Export to FTP or AWS S3 | Check current destination and credential requirements before use. |
The API material also describes custom User-Agent and Accept-Language settings. It does not establish that these options change the response into a PDF.
4. If the deliverable must be a PDF
Choose the method based on what the recipient expects. A PDF containing a screenshot is visually fixed but may be one raster image with no selectable text. A browser-generated PDF can preserve text and links and supports print CSS, page size, margins, and pagination.
Option A: print the page with a browser
For a one-off capture, open the webpage in a browser and use its Print command, then choose Save as PDF. Enable background graphics if the page’s colors or backgrounds matter. Review the page breaks and headers/footers before sharing.
Option B: automate print-to-PDF with Playwright
Install Playwright and its Chromium browser in your project, then run a script like this. It navigates to the page, waits for the load event, and writes a PDF using print CSS. Some pages continue loading content after the load event; adapt the wait condition for the target site.
import { chromium } from "playwright";
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({
viewport: { width: 1440, height: 900 },
});
await page.goto("https://example.com", {
waitUntil: "networkidle",
timeout: 60_000,
});
await page.pdf({
path: "page.pdf",
format: "A4",
printBackground: true,
margin: {
top: "12mm",
right: "12mm",
bottom: "12mm",
left: "12mm",
},
});
} finally {
await browser.close();
}
For installation and API details, use the Playwright installation guide and Page.pdf API reference. In production, pin your Playwright version and install the matching browser build. If the site requires authentication, create a browser context with the appropriate storage state or log in through the page; protect credentials and state files.
Option C: package an image capture as a PDF
If the requirement is merely a PDF container with a visual record, convert the downloaded image using a PDF library or a local image utility. This does not recreate text, hyperlinks, or proper pagination. A very tall full-page image may also become difficult to read when fitted to a standard sheet.
5. Or skip the browser setup
For an actual PDF response, ScreenshotNeo supports PDF output and controls such as paper size, margins, landscape orientation, and page ranges. It also provides a screenshot API and an MCP server for AI agents.
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 API documentation for request options. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers identify the page verdict and billing status. Its MCP server lets Claude, Cursor, and other MCP clients use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free monthly allowance.
6. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Response is an error message rather than an image | Missing or invalid access key, exhausted allowance, invalid function, or invalid target URL | Check the key, plan usage, endpoint, and that the URL includes its protocol. Read the response body before saving it as an image. |
| Saved file will not open as a PDF | The response is PNG, JPEG, or GIF; an extension change does not convert it | Use a browser print-to-PDF workflow or explicitly convert the image with a separate tool. |
| Page looks incomplete | Dynamic content had not rendered or the capture was not full-page | Try fullpage=1 and a modest delay; verify whether the page needs interaction or authentication. |
| Capture shows the wrong language or layout | Locale, user agent, or viewport affects the site | Set accept_lang, user_agent, and viewport consistently. |
| Old content appears | Cached capture is being reused | Adjust ttl or request force=1 if supported for the account. |
| Styles are missing | Stylesheet URL is unavailable to the capture service or blocked | Check the stylesheet URL and access rules; use css_url only with a reachable stylesheet. |
| Script reports an image/PDF parsing error | An API error body was written as binary output, or an image was mistaken for a PDF | Check HTTP status and content type before writing; validate the actual file signature or open it with the intended reader. |
The archived specification’s error materials appear inconsistent about code 104, describing it as both an invalid-key example and a usage-limit error in different places. Avoid hard-coding that interpretation; use the current vendor error reference or message text.
7. Performance, reliability, and cost
- Rendering time: Larger full-page captures, delayed content, and complex pages take longer. Set client timeouts to fit the page and API behavior, and avoid adding delay unless the target needs it.
- Cache freshness: The documented default TTL is 30 days. A long TTL can reduce repeated work but may return stale content; shorter TTL or a forced capture improves freshness at the cost of recapturing.
- Reliable output handling: Check status and content type before saving bytes. Keep API credentials server-side, and retry only transient network or server failures with bounded backoff. Do not blindly retry invalid keys, invalid URLs, or exhausted plans.
- PDF fidelity: Screenshot-to-PDF packaging keeps pixels but not document structure. Browser print-to-PDF is better when selectable text, links, or print CSS matter; verify page breaks, fonts, and backgrounds.
- Pricing: The accessible vendor FAQ describes 100 monthly snapshots on its free tier and paid plans starting at USD 19.99 per month, with overage charges beyond plan allowance. These terms can change; confirm current plan limits and billing before estimating production cost.
8. FAQ
Can I use format=PDF?
The accessible Screenshotlayer sources do not document that value. They list PNG, JPEG, and GIF. Confirm with the vendor before attempting a PDF parameter.
Can I convert a screenshot image into a searchable PDF?
Wrapping an image in a PDF does not make its text searchable. Searchable text requires OCR or a browser-generated PDF with text content preserved.
Why does PDF output look different from a screenshot?
Print rendering applies page dimensions and print styles, then paginates. A screenshot captures a viewport or page surface as pixels.
Does the archived specification settle what the API supports today?
No. It is useful for the documented workflow but may be outdated. The current detailed docs could not be retrieved for this research, so verify current PDF support with Screenshotlayer.


