# Website Screenshot and URL/HTML to PDF Renderer (`bravona/screenshot-pdf-renderer`) Actor

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

## Pricing

from $3.00 / 1,000 screenshot or pdf captureds

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 and URL/HTML to PDF Renderer

**Website Screenshot and URL/HTML to PDF Renderer** turns **public web pages or your own raw HTML** into **PNG, JPEG or WebP screenshots** (full page or viewport) or **print-ready PDFs**. Each file is saved to the run's key-value store, and a dataset record links to it, with its size, dimensions, page count and HTTP status.

You pay only for captures that succeed. Pages that fail, time out, sit behind a bot wall or a login, or point to a private address get an error record and are never charged.

### What does it do?

- **Screenshots:** full scrollable page (up to 30,000 px) or just the viewport, or one element (`captureSelector`). Choose PNG, JPEG or WebP and set the quality.
- **PDFs** from any URL or HTML: A4, Letter, Legal, A3, A5 or Tabloid; portrait or landscape; margins; print backgrounds; print or screen CSS; scale; and a page cap.
- **Raw HTML to PNG/PDF.** Good for invoices, reports, receipts and email previews. Relative links resolve against your base URL.
- **Devices:** custom viewport (320–3840 × 240–2160) and 1×, 1.5×, 2× or 3× scale, or presets for desktop, HD desktop, retina laptop, iPhone 15 Pro, Pixel 5 and iPad Pro 11.
- **Waiting:** DOM content loaded, load, or network idle (the default). You can also wait for a CSS selector or add a fixed delay. Lazy images are loaded by scrolling first.
- **Clean captures:** optional cookie-banner hiding (CSS only; nothing is clicked or accepted), your own hide selectors and injected CSS. Ads and trackers are blocked by default.
- **Safe by design:** private, internal, loopback and cloud-metadata addresses are refused, including through redirects, meta refresh and DNS. robots.txt is respected by default. Bot walls, CAPTCHAs and login pages are **detected and reported, never bypassed**.

### Who is it for?

- **Marketers and SEO teams:** archiving pages and competitor monitoring.
- **QA teams:** visual checks across viewports.
- **Developers:** generating PDFs from HTML templates.
- **Automation builders:** anyone who needs "URL → image/PDF" as one step in a workflow (Make, Zapier, n8n, the API).

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Public http(s) pages: plain strings `"https://…"` or `{ "url": "…" }` objects (both work, mixed too) | – |
| `html`, `htmlBaseUrl` | One raw HTML document (≤ 5 MB) and its base URL | – |
| `htmlDocuments` | Several: `[{ "name", "html", "baseUrl" }]` | – |
| `format` | `png`, `jpeg`, `webp` or `pdf` | `png` |
| `fullPage` | Whole page or viewport only | `true` |
| `devicePreset` | `custom`, `desktop`, `desktopHd`, `laptopRetina`, `iPhone15Pro`, `pixel5`, `iPadPro11` | `custom` |
| `viewportWidth` / `viewportHeight` | 320–3840 / 240–2160 | 1280 / 800 |
| `deviceScaleFactor` | 1, 1.5, 2, 3 | 1 |
| `quality` | JPEG/WebP quality 1–100 | 80 |
| `captureSelector` | Capture one element only | – |
| `maxPageHeight` | Full-page height cap in CSS px (240–30000) | 20000 |
| `waitUntil` | `domcontentloaded`, `load`, `networkidle` | `networkidle` |
| `networkIdleTimeoutSecs` | Longest wait for idle; busy pages are captured anyway | 5 |
| `waitForSelector` | Selector that must appear (else `SELECTOR_TIMEOUT`) | – |
| `delaySecs` | Extra wait before capture (0–30) | 0 |
| `scrollToLoadLazyContent` | Scroll first so lazy images load | `true` |
| `timeoutSecs` | Hard limit per URL, load and capture included (5–180) | 60 |
| `hideCookieBanners` | Hide common consent banners with CSS | `false` |
| `hideSelectors`, `injectCss` | Your own clean-up CSS | – |
| `blockAdsAndTrackers` | Refuse ~90 ad/analytics/tag-manager domains | `true` |
| `pdfPageSize`, `pdfLandscape`, `pdfMarginTop/Right/Bottom/Left`, `pdfPrintBackground`, `pdfMediaType`, `pdfScale`, `maxPdfPages` | PDF layout | A4, portrait, 0, `true`, `print`, 1, 50 |
| `captureErrorPages` | Capture HTTP 4xx/5xx pages (charged) instead of an error record | `false` |
| `respectRobotsTxt` | Skip URLs robots.txt disallows | `true` |
| `maxCaptures` | Safety cap on sources per run (1–5000) | 100 |
| `maxConcurrency` | 0 = automatic by memory | 0 |

Example:

```json
{
  "urls": ["https://example.com", { "url": "https://www.wikipedia.org" }],
  "format": "pdf",
  "pdfPageSize": "Letter",
  "pdfMarginTop": "10mm", "pdfMarginBottom": "10mm",
  "hideCookieBanners": true
}
```

### Output

Files go in the run's **default key-value store** (`capture-0001-example-com.png`, …). There is **one dataset record per source**. Records arrive as captures finish; `sourceIndex` gives each one its position in the input:

```json
{
  "status": "ok", "sourceIndex": 0, "sourceType": "url", "source": "https://example.com",
  "finalUrl": "https://example.com/", "httpStatus": 200, "title": "Example Domain",
  "format": "png", "contentType": "image/png",
  "fileKey": "capture-0000-example-com.png",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<id>/records/capture-0000-example-com.png",
  "sizeBytes": 34210, "widthPx": 1280, "heightPx": 800, "pageHeightCss": 800,
  "heightTruncated": false, "pdfPageCount": null, "pdfTruncated": false,
  "pageRequests": 2, "pageTransferBytes": 2021, "heavyPage": false,
  "warnings": [], "billable": { "capture": 1, "heavy-page": 0 }, "errorCode": null, "errorMessage": null,
  "loadMs": 812, "captureMs": 190, "processingMs": 1140, "capturedAt": "2026-11-04T18:00:00.000Z"
}
```

The `OUTPUT` record in the key-value store sums up the run: sources, ok/failed counts, errors by code, billable and charged events, the charge-limit flag, totals, memory and browser launches.

#### Error codes (never charged)

| Code | Meaning |
|---|---|
| `INVALID_URL`, `INVALID_HTML` | Not an http(s) URL, or the HTML is empty or over 5 MB |
| `BLOCKED_ADDRESS` | The URL, a redirect or meta refresh, or its DNS points to a private/internal/loopback/metadata address |
| `ROBOTS_DISALLOWED`, `ROBOTS_UNAVAILABLE` | robots.txt forbids the URL or could not be read |
| `AUTH_REQUIRED` | HTTP 401/407 or a login page |
| `CAPTCHA_OR_BOT_WALL` | A CAPTCHA or bot-protection page (Cloudflare, DataDome, PerimeterX, Akamai, …). It is reported, not bypassed |
| `HTTP_ERROR` | HTTP 4xx/5xx (unless `captureErrorPages` is on) |
| `NETWORK_ERROR` | DNS, TLS or connection failure |
| `UNSUPPORTED_CONTENT` | The URL is a download or non-HTML file |
| `TIMEOUT` | Over `timeoutSecs` |
| `SELECTOR_TIMEOUT`, `SELECTOR_NOT_FOUND` | `waitForSelector` never appeared / `captureSelector` matched nothing |
| `CAPTURE_FAILED` | The browser could not produce the file |
| `CHARGE_LIMIT_REACHED` | Your max total charge was reached; the rest were skipped |

### Pricing

Pay per event. Failures cost nothing.

| Event | Price |
|---|---|
| Actor Start | $0.00005 per run, per GB of memory (2 GB default: $0.0001) |
| Screenshot or PDF captured (primary) | $0.003 per successful screenshot or PDF |
| Heavy page add-on (3 MB+) | $0.004, added to a capture when the page downloaded at least 3 MB over the network before capture (`pageTransferBytes` on the record; blocked ads and trackers not counted) |

A light page costs $0.003; a heavy page $0.007. Failed sources are not charged. See [PRICING.md](PRICING.md) for details.

Works on Apify's free plan; you pay a tiny start fee plus only for results returned (each captured screenshot or PDF, and the add-on for heavy pages). Charges come out of your Apify account's prepaid usage; on the Free plan, once that monthly usage is used up, runs stop until the next billing cycle.

### Limits and notes

- Only public, logged-out pages. There is no login, cookie or proxy input, and the actor never solves CAPTCHAs.
- WebP images are cut at 16,383 px tall (a WebP format limit), with a warning. Use PNG or JPEG for taller pages.
- Heavy news and ad-funded sites often hit bot walls, or load slowly and time out. They return error records and aren't charged.
- One output format per run. Run twice to get both a PNG and a PDF.
- Memory: 2 GB (default) runs 2 pages at a time. More memory runs more pages in parallel but costs about the same per capture.

### Legal

Capture only pages you are allowed to copy. Respect sites' terms of service and copyright. The actor identifies itself in its user agent and follows robots.txt by default.

# Actor input Schema

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

Public http(s) pages to capture, one file per URL. One URL per line in the form; the API also accepts plain strings \["https://…"] or request objects \[{"url": "https://…"}]. Private, internal and loopback addresses are refused.

## `html` (type: `string`):

One HTML document to render (up to 5 MB). Relative links resolve against “HTML base URL”.

## `htmlBaseUrl` (type: `string`):

Optional public base URL for relative links and assets in “Raw HTML”.

## `htmlDocuments` (type: `array`):

Several HTML documents: \[{"name": "invoice-1", "html": "<html>…", "baseUrl": "https://…"}]. Up to 500 per run, 5 MB each.

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

PNG, JPEG or WebP screenshot, or a PDF.

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

Capture the whole scrollable page (up to “Max page height”). Off = the visible viewport only. Images only.

## `devicePreset` (type: `string`):

Sets viewport, scale, mobile mode and user agent. “Custom” uses the fields below.

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

320–3840.

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

240–2160.

## `deviceScaleFactor` (type: `string`):

1, 1.5, 2 or 3 (2 = retina). Higher values make bigger files.

## `quality` (type: `integer`):

1–100. Ignored for PNG and PDF.

## `captureSelector` (type: `string`):

Capture only this element instead of the page. Images only.

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

Full-page captures stop at this CSS height (240–30000); a warning says when a page was cut.

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

When the page counts as loaded before capture.

## `networkIdleTimeoutSecs` (type: `integer`):

Longest wait for network idle (0–60). Pages that never go idle are captured anyway.

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

CSS selector that must appear before capture; if it never appears the source fails with SELECTOR_TIMEOUT (no charge).

## `delaySecs` (type: `integer`):

Wait this long after loading, before capture (0–30).

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

Scroll down the page before a full-page capture so lazy images load.

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

Hard time limit per URL or HTML document, load and capture included (5–180). Over the limit = TIMEOUT error, no charge.

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

Hide common cookie/consent banners with CSS. Nothing is clicked or accepted.

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

CSS selectors to hide before capture.

## `injectCss` (type: `string`):

Extra CSS injected before capture (up to 100,000 characters).

## `blockAdsAndTrackers` (type: `boolean`):

Refuse requests to about 90 well-known ad, analytics and tag-manager domains. Pages load faster, cost less and show no ad slots. Turn off to capture pages exactly as a visitor with no ad blocker sees them.

## `pdfPageSize` (type: `string`):

Paper size for PDF output.

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

Landscape orientation.

## `pdfMarginTop` (type: `string`):

CSS length, e.g. 10mm, 0.5in, 20px.

## `pdfMarginRight` (type: `string`):

CSS length.

## `pdfMarginBottom` (type: `string`):

CSS length.

## `pdfMarginLeft` (type: `string`):

CSS length.

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

Include background colors and images.

## `pdfMediaType` (type: `string`):

Render with print CSS (as the browser's Print does) or screen CSS (looks like the screen).

## `pdfScale` (type: `string`):

Zoom 0.1–2 (e.g. 0.8).

## `maxPdfPages` (type: `integer`):

Keep at most this many pages per PDF (1–500); a warning says when a PDF was cut.

## `captureErrorPages` (type: `boolean`):

Capture pages that answer with HTTP 4xx/5xx (charged as captures). Off = an HTTP_ERROR record, no charge. Bot walls and login pages are never captured.

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

Skip URLs that robots.txt disallows for this actor (ROBOTS_DISALLOWED, no charge).

## `maxCaptures` (type: `integer`):

Safety cap on URLs + HTML documents per run (1–5000).

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

0 = automatic by memory (1 GB: 1, 2 GB: 2, 4 GB: 4, 8 GB: 6). Max 10.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "format": "png",
  "fullPage": true,
  "devicePreset": "custom",
  "viewportWidth": 1280,
  "viewportHeight": 800,
  "deviceScaleFactor": "1",
  "quality": 80,
  "maxPageHeight": 20000,
  "waitUntil": "networkidle",
  "networkIdleTimeoutSecs": 5,
  "delaySecs": 0,
  "scrollToLoadLazyContent": true,
  "timeoutSecs": 60,
  "hideCookieBanners": false,
  "blockAdsAndTrackers": true,
  "pdfPageSize": "A4",
  "pdfLandscape": false,
  "pdfMarginTop": "0",
  "pdfMarginRight": "0",
  "pdfMarginBottom": "0",
  "pdfMarginLeft": "0",
  "pdfPrintBackground": true,
  "pdfMediaType": "print",
  "pdfScale": "1",
  "maxPdfPages": 50,
  "captureErrorPages": false,
  "respectRobotsTxt": true,
  "maxCaptures": 100,
  "maxConcurrency": 0
}
```

# Actor output Schema

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

All records in the default dataset, one per URL or HTML document: the link to the captured file, its size and dimensions, or an error record.

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

Screenshots and PDFs in the default key-value store (keys starting with capture-).

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

The OUTPUT record in the default key-value store: resolved input, per-source status, totals, billable and charged events.

# 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("bravona/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://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("bravona/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://example.com"
  ]
}' |
apify call bravona/screenshot-pdf-renderer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bravona/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/NYpbFbGEbNuGGzX30/builds/4Po5qqm8FHyH754Yn/openapi.json
