# Website Screenshot & PDF Renderer (`sapphire_studio/screenshot-pdf-renderer`) Actor

Turn web page URLs into PNG, JPEG or WebP screenshots or PDF files. Full page or viewport, single element, dark mode, cookie banner and ad removal. One row per URL with the file link, size and final URL. Pay only per successful render.

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

## Pricing

$3.00 / 1,000 page rendereds

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

### What does Website Screenshot & PDF Renderer do?

Website Screenshot & PDF Renderer turns a list of web page URLs into image or PDF files. Each URL is opened in a real Chromium browser and saved as a **PNG, JPEG or WebP screenshot** or as a **PDF document**. You can capture the visible viewport, the **full scrollable page** (lazy-loaded images are scrolled into view first) or a **single element** picked by CSS selector. Cookie banners, consent pop-ups, ads and trackers are removed by default, so the result looks like the page a person sees after closing the pop-ups.

Every URL produces exactly one dataset row with a direct download link to the file, its size, pixel dimensions or PDF page count, the final URL after redirects, the HTTP status and the page title. Failed URLs get a clear status and reason instead of disappearing.

#### Who is it for?

- **AI agents and LLM apps** that need to "see" a page: the output is a plain array of rows with file links, the input is an array of URLs, and pricing is pay per event only, so it can be called per request.
- **QA and visual regression** pipelines that need consistent viewport, pixel density and dark mode screenshots.
- **SEO, marketing and social preview** tools that need thumbnails or full-page captures of many sites.
- **Compliance and archiving**: save PDF or full-page copies of public pages with a timestamp.

### How to use it

1. Paste one or more page URLs into **Page URLs**.
2. Pick the **Output format** (PNG, JPEG, WebP or PDF) and, if you want, turn on **Full page** or enter an **Element to capture**.
3. Run the Actor. Open the **Renders** tab of the run and click the file links, or download the dataset as JSON, CSV or Excel.

Example input (the prefilled example, finishes in about 20 seconds):

```json
{
  "urls": ["https://apify.com", "https://en.wikipedia.org/wiki/Web_scraping"],
  "format": "png"
}
```

A full-page JPEG of several sites:

```json
{
  "urls": ["https://www.python.org", "https://www.bbc.com/news", "https://react.dev"],
  "format": "jpeg",
  "fullPage": true,
  "imageQuality": 75
}
```

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | array of strings | required | Public http or https pages, up to 1000 per run. Duplicates (same URL ignoring `#hash`) are rendered once. |
| `format` | `png`, `jpeg`, `webp`, `pdf` | `png` | Output file type. |
| `fullPage` | boolean | `false` | Capture the whole scrollable page instead of the viewport. |
| `selector` | string | none | Capture only the first visible element matching this CSS selector (images only). |
| `viewportWidth` / `viewportHeight` | integer | 1280 / 800 | Browser window size in CSS pixels. |
| `deviceScaleFactor` | integer 1 to 3 | 1 | Pixel density; 2 gives retina-quality images. |
| `darkMode` | boolean | `false` | Request the page's dark color scheme. |
| `removeCookieBanners` | boolean | `true` | Hide cookie banners and consent pop-ups; nothing is clicked or accepted. |
| `blockAds` | boolean | `true` | Skip requests to common ad and analytics networks. |
| `hideSelectors` | array of strings | none | Extra CSS selectors to hide, such as chat widgets. |
| `waitUntil` | `load`, `networkidle`, `domcontentloaded` | `load` | When the page counts as loaded. |
| `waitForSelector` | string | none | Wait up to 15 s for this element before capturing. |
| `delayMs` | integer | 500 | Extra wait before capturing. |
| `timeoutSecs` | integer | 30 | Page load timeout per attempt. |
| `imageQuality` | integer 1 to 100 | 80 | JPEG and WebP quality. |
| `maxHeight` | integer | 10000 | Full-page and element captures are cut at this height in CSS pixels. |
| `pdfPaperFormat` | `A4`, `Letter`, `Legal`, `A3`, `Tabloid` | `A4` | PDF paper size. |
| `pdfLandscape` | boolean | `false` | Landscape PDF pages. |
| `pdfPrintBackground` | boolean | `true` | Include background colors and images in the PDF. |
| `maxConcurrency` | integer 1 to 4 | 3 | Pages rendered in parallel (Advanced). |
| `debug` | boolean | `false` | Save HTML of failed pages and traffic per host to the key-value store (Advanced). |

### Output

The files are stored in the run's default key-value store (keys start with `render-`). `file_url` is a signed link that downloads the file without an API token. Real ok row from a live run (full-page JPEG; the store id and signature in `file_url` are replaced with `<storeId>` and `<signature>` here):

```json
{
  "url": "https://www.python.org",
  "final_url": "https://www.python.org/",
  "status": "ok",
  "ok": true,
  "error": null,
  "http_status": 200,
  "page_title": "Welcome to Python.org",
  "format": "jpeg",
  "content_type": "image/jpeg",
  "file_key": "render-3a612d3b0026605c96ab.jpg",
  "file_url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/render-3a612d3b0026605c96ab.jpg?signature=<signature>",
  "file_bytes": 299635,
  "width": 1280,
  "height": 2747,
  "pdf_pages": null,
  "full_page": true,
  "selector": null,
  "viewport_width": 1280,
  "viewport_height": 800,
  "device_scale_factor": 1,
  "dark_mode": false,
  "banners_hidden": 0,
  "requests_blocked": 0,
  "load_state_reached": true,
  "transfer_bytes": 491540,
  "render_ms": 3703,
  "checked_at": "2026-10-27T01:49:35.169Z",
  "attempts": 1,
  "fetch_mode": "browser"
}
```

Real failed row from the same run (the site answered with a bot-protection challenge, so nothing was captured and nothing was charged; the option fields are the same as above and shortened here):

```json
{
  "url": "https://www.reuters.com",
  "final_url": "https://www.reuters.com/",
  "status": "blocked",
  "ok": false,
  "error": "The site refused the request (HTTP 401, ct.captcha-delivery.com); no screenshot taken",
  "http_status": 401,
  "page_title": "reuters.com",
  "format": "jpeg",
  "content_type": null,
  "file_key": null,
  "file_url": null,
  "file_bytes": null,
  "width": null,
  "height": null,
  "pdf_pages": null,
  "transfer_bytes": 32143,
  "render_ms": 907,
  "checked_at": "2026-10-27T01:50:09.760Z",
  "attempts": 2,
  "fetch_mode": "browser"
}
```

For PDF output `width` and `height` are null and `pdf_pages` holds the page count. A `SUMMARY` record in the key-value store has counts by status, run time and traffic.

#### Status values

| Status | Meaning | Charged |
|---|---|---|
| `ok` | File rendered and stored. | yes |
| `not_found` | HTTP 404 or 410, or the requested element or wait-for element never appeared. | no |
| `blocked` | The site refused access (HTTP 401, 403, 429) or served a bot-protection challenge. | no |
| `invalid_input` | Not a valid http(s) URL, or a private or internal network address. | no |
| `timeout` | The run reached its time limit before this URL was rendered. | no |
| `charge_limit_reached` | Your maximum charge per run was reached. | no |
| `error` | The page failed to load after retries (DNS failure, TLS error, server error). | no |

### Pricing

Pay per event: one `render` event per row with status `ok`. Failed, blocked, invalid, duplicate and not-found URLs are free. Set **Maximum cost per run** in the run options to cap spending; the Actor stops starting new pages when the cap is reached and lists the remaining URLs as `charge_limit_reached`. No proxy add-on or usage fee is passed on to you.

### Limitations

- Measured on Apify (4096 MB, 3 parallel pages): 20 popular sites as full-page JPEG in 72 seconds, 18 of 20 ok. The two failures were sites behind bot protection (stackoverflow.com and reuters.com). Viewport screenshots of simple pages take 1 to 4 seconds each.
- Pages behind bot protection or a CAPTCHA are reported as `blocked` and are free. The Actor never solves CAPTCHAs. Large news and shopping sites (for example nytimes.com, amazon.com, reuters.com) are often blocked.
- No logins: pages behind a login show what a signed-out visitor sees.
- Full-page and element captures are cut at `maxHeight` (at most 16000 CSS pixels, lower at high pixel density) because of browser bitmap limits.
- Cookie banner removal covers the common consent tools and generic cookie overlays; an unusual banner may remain. Use `hideSelectors` for those.
- Renders come from Apify's data center network, so some sites show a country or language version based on that location.

### FAQ

**Can I use it from an AI agent?** Yes. Input is an array of URLs, output is one row per URL with a signed file link, and pricing is pay per event only.

**Why was my page `blocked`?** The site answered with an access-denied page or a bot-protection challenge. Retrying later sometimes works; the Actor does not try to defeat the protection.

**Are the files kept?** They live in the run's key-value store and follow your account's data retention settings. Download them or copy them elsewhere if you need them long term.

**Can I render pages on my local network?** No. Private, local and internal addresses are refused, including redirects to them.

### Legal disclaimer

This Actor is not affiliated with, endorsed by or sponsored by any of the websites it renders. All trademarks belong to their owners. It reads publicly available pages only; no login, no personal data. You are responsible for having the right to capture and use the pages you render.

### Support

Open an issue on the Actor's Issues tab with the run ID and the input that did not work.

Turning on **Save debug data** for that run helps a lot.

Built and maintained by Sapphire Studio.

# Changelog

This Actor's version history is a separate document: https://apify.com/sapphire_studio/screenshot-pdf-renderer/changelog.md

# Actor input Schema

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

Public web pages to render, one per line, as full http or https addresses. One dataset row per URL. Only rows with status "ok" are charged; invalid, duplicate, not found and blocked URLs are free. Up to 1000 URLs per run.

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

File type to produce. PNG is lossless, JPEG and WebP are much smaller, PDF gives a printable, text-searchable document.

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

Capture the whole scrollable page instead of only the visible viewport. The page is scrolled first so lazy-loaded images appear. Very long pages are cut at "Maximum full-page height". Ignored for PDF, which always contains the whole page.

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

Optional. Screenshot only the first element that matches this CSS selector, for example #main or .pricing-table. If no visible element matches, the row gets status "not_found" and is not charged. Not available for PDF.

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

Browser window width in CSS pixels. 1280 is a typical laptop, 390 a phone.

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

Browser window height in CSS pixels. This is the screenshot height unless Full page is on.

## `deviceScaleFactor` (type: `integer`):

1 for standard screens, 2 for retina-quality images (twice the width and height in pixels, larger files).

## `darkMode` (type: `boolean`):

Ask the page for its dark color scheme (prefers-color-scheme: dark). Pages without a dark theme look the same.

## `removeCookieBanners` (type: `boolean`):

Hide cookie banners and consent pop-ups from common consent tools and skip loading those tools. Nothing is accepted or clicked on your behalf.

## `blockAds` (type: `boolean`):

Do not load requests to common ad and analytics networks. Renders are faster and cleaner; ad slots may appear empty.

## `hideSelectors` (type: `array`):

Optional CSS selectors of elements to hide before capturing, for example a chat widget (#intercom-container) or a sticky header. Up to 50.

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

When the page counts as loaded. "Load" suits most pages. "Network idle" waits for late requests (up to 20 seconds, then the page is captured anyway). "DOM ready" is fastest but images may still be missing.

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

Optional. Wait up to 15 seconds for this element to be visible before capturing. If it never appears, the row gets status "not_found" and is not charged.

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

Additional wait after loading and before capturing, for animations and late content.

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

How long to wait for a page to start loading before the attempt fails. Failed loads are retried up to 3 times.

## `imageQuality` (type: `integer`):

Compression quality for JPEG and WebP, 1 to 100. Ignored for PNG and PDF.

## `maxHeight` (type: `integer`):

Full-page screenshots are cut at this height in CSS pixels. Lowered automatically for high pixel density and very wide viewports so images stay within browser limits.

## `pdfPaperFormat` (type: `string`):

Paper size for PDF output.

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

Landscape page orientation for PDF output.

## `pdfPrintBackground` (type: `boolean`):

Include background colors and images in PDF output, so the PDF looks like the page on screen.

## `maxConcurrency` (type: `integer`):

Number of pages rendered at the same time. More is faster but needs memory and CPU: the Actor also caps this at (memory MB minus 512) divided by 512. With the default 4096 MB, 3 is a good balance.

## `debug` (type: `boolean`):

Save the HTML of failed pages and traffic per host to the run's key-value store to help diagnose problems. Never added to the dataset. Leave off unless support asks for it.

## Actor input object example

```json
{
  "urls": [
    "https://apify.com",
    "https://en.wikipedia.org/wiki/Web_scraping"
  ],
  "format": "png",
  "fullPage": false,
  "viewportWidth": 1280,
  "viewportHeight": 800,
  "deviceScaleFactor": 1,
  "darkMode": false,
  "removeCookieBanners": true,
  "blockAds": true,
  "waitUntil": "load",
  "delayMs": 500,
  "timeoutSecs": 30,
  "imageQuality": 80,
  "maxHeight": 10000,
  "pdfPaperFormat": "A4",
  "pdfLandscape": false,
  "pdfPrintBackground": true,
  "maxConcurrency": 3,
  "debug": false
}
```

# Actor output Schema

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

Dataset items: one row per URL with status, file URL, size and final URL.

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

Key-value store with the rendered screenshots and PDFs (keys start with render-).

## `summary` (type: `string`):

Counts by status, run duration and traffic.

# 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://apify.com",
        "https://en.wikipedia.org/wiki/Web_scraping"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sapphire_studio/screenshot-pdf-renderer").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://apify.com",
        "https://en.wikipedia.org/wiki/Web_scraping",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sapphire_studio/screenshot-pdf-renderer").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://apify.com",
    "https://en.wikipedia.org/wiki/Web_scraping"
  ]
}' |
apify call sapphire_studio/screenshot-pdf-renderer --silent --output-dataset

```

## MCP server setup

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

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/ntJvnwp7MtCp9zE5s/builds/EZvUChm76NlXwy0AM/openapi.json
