# Website Screenshot Generator: PNG, JPEG & PDF of Any URL (`registrydata/website-screenshot-generator`) Actor

Capture screenshots or PDFs of any web page: full page, viewport, one element, mobile devices, dark mode, retina, cookie-banner hiding. Files saved with public links.

- **URL**: https://apify.com/registrydata/website-screenshot-generator.md
- **Developed by:** [Registry Data](https://apify.com/registrydata) (community)
- **Categories:** Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 screenshots

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Website Screenshot Generator: PNG, JPEG & PDF of Any URL

Capture a screenshot or PDF of any public web page with a real Chromium browser. Choose the **full page** or just the visible window, a **single element** by CSS selector, a **mobile device** (iPhone, Pixel, iPad and more), **dark mode**, **retina** resolution, **PDF output**, and **cookie-banner hiding**. Every file is saved in the run's key-value store and the dataset gives you a public link, size, title and status for each one.

**Price: $2.00 per 1,000 screenshots.** Set a maximum cost per run and the run stops there. Details under [Pricing](#pricing).

Typical uses: visual archiving and monitoring, QA and design review, link previews and thumbnails, reports, and giving AI agents an image of a page. A failed page is never billed.

The default input captures one sample page in under a minute.

### What you get

One dataset item per screenshot, and the file itself in the key-value store.

| Field | Meaning |
|---|---|
| `url`, `final_url`, `title`, `status_code` | The page you asked for, where it ended up after redirects, its title and HTTP status |
| `screenshot_url`, `storage_key` | Link to the file, and its key in the key-value store |
| `format`, `width`, `height`, `size_bytes` | File type and actual pixel size (including pixel density) and byte size |
| `full_page`, `selector`, `device`, `color_scheme` | The settings used |
| `page_height`, `height_truncated` | Full page height in CSS pixels, and whether the capture was cropped at the maximum height |
| `warnings` | Notes such as `load_timeout` (the page's load event never finished, so what was on screen was captured) |
| `elapsed_ms`, `source_url`, `source_record_id`, `scraped_at` | Timing and provenance |

### Input options

```json
{
  "urls": ["https://example.com", "https://example.org/pricing"],
  "format": "png",
  "fullPage": true,
  "device": "iPhone 13",
  "deviceScaleFactor": 2,
  "colorScheme": "dark",
  "hideCookieBanners": true,
  "waitUntil": "networkidle",
  "waitForSelector": "#main",
  "delayMs": 500
}
```

| Option | Meaning |
|---|---|
| `urls` | Pages to capture (public http and https only). Empty runs a one-page demo |
| `format` | `png`, `jpeg` (with `jpegQuality`) or `pdf` (with `pdfFormat` and `pdfLandscape`) |
| `fullPage` | Whole scrollable page. The page is scrolled once first so lazy-loaded images appear |
| `selector` | Capture only the element matching this CSS selector (not for PDF) |
| `viewportWidth`, `viewportHeight` | Window size for desktop captures (default 1280 by 800) |
| `device` | Emulate a device: screen size, pixel density, touch and mobile user agent (`iPhone 13`, `Pixel 7`, `iPad Pro 11`, `Galaxy S9+`, ...) |
| `deviceScaleFactor` | 1 to 3; 2 gives retina-quality images |
| `colorScheme` | `light` or `dark`, for sites that support both |
| `waitUntil`, `waitForSelector`, `delayMs` | When the page counts as ready: load event, DOM loaded or network idle; an element to wait for; an extra delay for animations |
| `hideCookieBanners` | Hides common consent pop-ups. Nothing is clicked or accepted; elements are only hidden |
| `maxPageHeight` | Full-page captures taller than this are cropped and flagged (Chromium's limit is about 16,000 px) |
| `timeoutSecs`, `respectRobotsTxt`, `maxConcurrentPages`, `maxItems` | Per-page timeout, robots.txt handling (on by default), parallel pages (default 3), and a cap on screenshots |

### Output sample

Real item from a test run:

```json
{
  "url": "https://www.python.org",
  "final_url": "https://www.python.org/",
  "title": "Welcome to Python.org",
  "status_code": 200,
  "format": "png",
  "full_page": true,
  "width": 1280,
  "height": 2574,
  "page_height": 2574,
  "height_truncated": false,
  "size_bytes": 481856,
  "screenshot_url": "https://api.apify.com/v2/key-value-stores/<store id>/records/screenshot-<hash>.png",
  "warnings": []
}
```

### Pricing

Pay per result: **$2.00 per 1,000 screenshots**, one result per file saved. A page that fails (timeout, error status, blocked, disallowed by `robots.txt`, invalid address) is **not billed**; it is listed with the reason in the `UNSUCCESSFUL_URLS` record. Use `maxItems` to cap a run.

Example: 5,000 full-page screenshots cost $10.00. In our test run, 12 pages with full-page capture and cookie-banner hiding took under a minute and produced 11 files.

### Limits and honest notes

- **Public pages only.** Addresses that point to private networks (localhost, internal IP ranges, cloud metadata addresses), including through redirects and embedded images, are refused. Pages behind a login are not captured.
- **robots.txt is honored by default.** A page that the site asks automated tools not to fetch is reported as `robots_disallowed` and not billed. If a site's `robots.txt` is unreachable because of a server error, the standard says to treat it as disallowed, and the Actor does.
- **Honest identification.** The browser's user agent ends with `WebsiteScreenshotGenerator/1.0 (+Apify Actor; honors robots.txt)`. Some sites block automated browsers and will answer with an error or a challenge page; those captures are not billed when the site returns an error status, but a challenge page that returns HTTP 200 will be captured as it appears. The Actor does not try to evade bot protection.
- **Tall pages are cropped, never silently:** above `maxPageHeight` (up to 16,000 px) the image is cropped and `height_truncated` is true. Use PDF for very long pages.
- **Elements and downloads:** a selector that matches nothing visible fails the page. File downloads and non-web addresses (`file:`, `ftp:`, `chrome:`) are refused.
- **Dynamic pages:** use `waitUntil: networkidle`, `waitForSelector` or `delayMs` for pages that render late. A page whose load event never finishes (a stuck third-party resource) is captured after the timeout with a `load_timeout` warning.
- **Memory:** each Chromium page needs memory; the default of 2 GB handles the default 3 pages in parallel.

### FAQ

**Is this legal?** The Actor loads the pages you give it the way a browser would, respects `robots.txt`, and refuses private addresses. You are responsible for having the right to capture and keep the pages you request, in particular for copyrighted or personal content.

**Where are my files?** In the run's default key-value store (the `screenshot_url` field links to each file). They stay with the run until your Apify data retention removes them; download or copy files you want to keep.

**Can I call it from code, a schedule, or an AI agent?** Yes: use the Apify API, schedules, webhooks or MCP, then read the dataset and fetch the files.

**Why was my page not captured?** See `UNSUCCESSFUL_URLS` for the reason: `timeout`, `http_<status>`, `robots_disallowed`, `blocked`, `dns_error`, `connection_error`, `selector_not_found`, `wait_selector_timeout`, `too_large`, or `invalid_input`.

# Actor input Schema

## `urls` (type: `array`):

Pages to capture, one per line. Leave empty to capture a sample page. Only public http and https addresses are allowed.

## `format` (type: `string`):

PNG (lossless), JPEG (smaller) or PDF (printable document).

## `fullPage` (type: `boolean`):

Capture the whole scrollable page instead of just the visible window. The page is scrolled first so lazy-loaded images appear. Heights above the "maximum page height" are cropped and flagged.

## `selector` (type: `string`):

Optional CSS selector, for example <code>#pricing</code> or <code>.hero</code>. Captures only that element. Not available for PDF.

## `viewportWidth` (type: `integer`):

Browser window width. Ignored when a device is chosen.

## `viewportHeight` (type: `integer`):

Browser window height. Ignored when a device is chosen.

## `device` (type: `string`):

Emulate a device: its screen size, pixel density, touch and mobile user agent. Examples: <code>iPhone 13</code>, <code>iPhone 15 Pro</code>, <code>Pixel 7</code>, <code>iPad Pro 11</code>, <code>Galaxy S9+</code>. Leave empty for a desktop window.

## `deviceScaleFactor` (type: `number`):

1 is standard; 2 gives retina-quality images (twice the pixels in each direction).

## `colorScheme` (type: `string`):

Ask sites that support it for their light or dark theme.

## `waitUntil` (type: `string`):

When the page counts as loaded. "load" waits for the load event; "networkidle" also waits for network activity to stop (slower, better for apps that load data).

## `waitForSelector` (type: `string`):

Optional CSS selector to wait for before capturing.

## `delayMs` (type: `integer`):

Additional wait after the page has loaded, for animations to finish.

## `hideCookieBanners` (type: `boolean`):

Hide common cookie and consent pop-ups (OneTrust, Cookiebot, Didomi, Usercentrics and many others) so they do not cover the page. Nothing is clicked or accepted; the elements are only hidden.

## `scrollToLoadLazyContent` (type: `boolean`):

For full-page captures, scroll down once before capturing so lazy-loaded images and sections render.

## `jpegQuality` (type: `integer`):

1 to 100. Only used for JPEG output.

## `pdfFormat` (type: `string`):

Paper size for PDF output.

## `pdfLandscape` (type: `boolean`):

Print PDFs in landscape orientation.

## `maxPageHeight` (type: `integer`):

Full-page captures taller than this are cropped (and the result is flagged with height_truncated). Chromium cannot render images taller than 16,000 px.

## `timeoutSecs` (type: `integer`):

Give up on a page that has not loaded in this time. The page is not billed.

## `respectRobotsTxt` (type: `boolean`):

Skip pages that a site's robots.txt asks automated tools not to fetch. Keep this on unless you own the site or have permission.

## `maxConcurrentPages` (type: `integer`):

How many pages are rendered at once. Pages of the same site are always captured one at a time. More parallel pages need more memory.

## `maxItems` (type: `integer`):

Stop after this many URLs. 0 means no limit. Every screenshot saved is billed, so this caps your cost.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "format": "png",
  "fullPage": false,
  "viewportWidth": 1280,
  "viewportHeight": 800,
  "deviceScaleFactor": 1,
  "colorScheme": "light",
  "waitUntil": "load",
  "delayMs": 0,
  "hideCookieBanners": false,
  "scrollToLoadLazyContent": true,
  "jpegQuality": 80,
  "pdfFormat": "A4",
  "pdfLandscape": false,
  "maxPageHeight": 16000,
  "timeoutSecs": 30,
  "respectRobotsTxt": true,
  "maxConcurrentPages": 3,
  "maxItems": 0
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

## `unsuccessful` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("registrydata/website-screenshot-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": ["https://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("registrydata/website-screenshot-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://example.com"
  ]
}' |
apify call registrydata/website-screenshot-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,registrydata/website-screenshot-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DoXezz1UtoJp2wbnl/builds/6XXFgSpFBCcvcx4Oy/openapi.json
