# Website Screenshot & HTML to Image / PDF (`klarto/website-screenshot-pdf`) Actor

Website screenshot API: capture URLs or your own HTML page as PNG, JPEG or PDF. Full page or one element, desktop, tablet or mobile, dark mode, common cookie banners hidden. Up to 1,000 URLs per run; dataset with file links. $0.003 per screen, $0.005 per full page or PDF; failed pages free.

- **URL**: https://apify.com/klarto/website-screenshot-pdf.md
- **Developed by:** [Klarto](https://apify.com/klarto) (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

from $2.10 / 1,000 screen captures

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & HTML to Image / PDF

**Website screenshot API** on Apify: capture web pages, or one HTML document of your own, as PNG, JPEG or PDF. Take the first screen, the full page or one element, on a desktop, tablet or mobile screen. You pay per successful capture: **$0.003 per screen or element, $0.005 per full page or PDF**, plus Apify's start event of $0.0001 per run at 2 GB.

**Why this Actor**

- **Plays fair with sites.** It checks robots.txt before opening each page, and again for the new site after a redirect to another site. It says who it is: every browser user agent ends with `KlartoScreenshot/0.1 (+https://apify.com/klarto)`. No proxy IPs, no CAPTCHA solving, no stealth plugins.
- **Safe with untrusted URLs and HTML.** Every browser connection goes through a filter inside the run that lets only public internet addresses through. Pages cannot reach private networks, localhost or cloud metadata addresses.
- **Only successful captures are charged.** Failed pages, pages that answer with HTTP 4xx/5xx, pages blocked by robots.txt and skipped pages are free. The only other charge is Apify's start event.
- **A strict charge limit.** Each capture reserves its price before it starts. When your maximum charge is reached, the remaining pages get status `skipped` and no file.
- **PDF and your own HTML.** Print pages as A4, Letter, Legal, A3 or A5 PDF, or render your own HTML, e.g. an Open Graph card, an invoice or a report.

### What it does

- **Input:** a list of URLs (up to 1,000 per run) and/or one HTML document of your own (up to 2 MB).
- **Formats:** PNG, JPEG (quality 10–100) or PDF (A4, Letter, Legal, A3, A5, with backgrounds).
- **What to capture:**
  - the first screen (default);
  - the full scrollable page, cut at `maxHeight` (10,000 CSS px by default);
  - one element: the first match of a CSS selector (PNG and JPEG only).
- **Devices:**

  | `device` | Screen (CSS px) | Pixel density | User agent |
  |---|---|---|---|
  | `desktop` (default) | 1280×800 | 1× | Chromium's own |
  | `laptop` | 1440×900 | 1× | Chromium's own |
  | `full-hd` | 1920×1080 | 1× | Chromium's own |
  | `tablet` | 820×1180 | 2× | iPad Safari, touch |
  | `mobile` | 390×844 | 3× | iPhone Safari, touch |

  Or a custom screen of 200–3,840 × 200–2,160 px and a pixel density of 1–3.
- **Options:** dark mode, cookie banners hidden with CSS (on by default), waiting for an element, an extra delay of up to 10 s.
- **Output:** one dataset item per page with its status and a link to the file. The files are in the run's key-value store. A run summary is in the `OUTPUT` record.

### How it works

1. **Checks each URL.** The host must resolve to public addresses only. Then the Actor reads the site's robots.txt as `KlartoScreenshot` (once per site per run).
2. **Opens the page** in headless Chromium (Playwright 1.65). It waits for the `load` event, up to 5 s for the network to go quiet, then for your element and delay. All of this shares one page time budget, `pageTimeoutSecs` (30 s by default).
3. **Prepares the page.** Common cookie banners are hidden with CSS. For a full-page PNG or JPEG, the page is scrolled down one screen at a time (0.15 s per step) so lazy images can start loading, then back to the top. PDFs are not scrolled.
4. **Takes the capture**: a Chromium screenshot (PNG or JPEG, CSS animations stopped) or Chromium's print to PDF, which uses the page's print styles. If the page redirected to another site, that site's robots.txt is checked now, and a disallowed capture is discarded.
5. **Saves, then charges.** The file goes to the key-value store and the item to the dataset. Only then is the capture charged.
6. **No outside services.** The Actor calls no third-party API. The browser talks only to the sites you give and the resources their pages load, through a local filtering proxy in the run's container. The proxy connects only to checked public IPs, also after redirects and for every image, script and WebSocket.

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | — | Pages to capture (up to 1,000). A link without `https://` gets it added. Duplicates are removed. |
| `html` | — | One HTML document of your own (up to 2 MB). It gets `fileIndex` 0. |
| `format` | `png` | `png`, `jpeg` or `pdf`. |
| `fullPage` | `false` | The whole scrollable page instead of the first screen. |
| `device` | `desktop` | `desktop`, `laptop`, `full-hd`, `tablet` or `mobile` (see the table above). |
| `selector` | — | Capture only the first element that matches this CSS selector. It must become visible within 10 s. |
| `hideCookieBanners` | `true` | Hide 29 common cookie-banner containers with CSS. Nothing is clicked or accepted. |
| `darkMode` | `false` | Ask the page for its dark color scheme. Only pages that support it change. |
| `waitForSelector` | — | Wait until this element is visible, within the page time budget; if it does not appear, the page fails with `error`. |
| `delayMs` | `0` | Extra wait after loading, 0–10,000 ms, shortened if the page time budget runs out. |
| `pageTimeoutSecs` | `30` | Time budget to load and prepare a page (loading, network quiet, `waitForSelector`, `delayMs`, scrolling), 5–120 s. |
| `maxHeight` | `10000` | Full-page cut-off in CSS px, 800–16,000. |
| `viewportWidth`, `viewportHeight` | `0` | Custom screen size; 0 = the device's size. |
| `scale` | `0` | Pixel density 1–3; 0 = the device's density. |
| `jpegQuality` | `80` | JPEG quality, 10–100. |
| `pdfFormat` | `A4` | `A4`, `Letter`, `Legal`, `A3` or `A5`. |
| `respectRobotsTxt` | `true` | Follow robots.txt. Turn off only for sites you own. |
| `maxConcurrency` | from memory | Tabs at the same time, 1–10 (see [Limits](#limits)). |

Minimal input (the Console prefill):

```json
{"urls": ["https://books.toscrape.com/", "https://quotes.toscrape.com/"]}
```

Full pages on a phone screen as JPEG:

```json
{"urls": ["https://books.toscrape.com/"], "fullPage": true, "device": "mobile", "format": "jpeg"}
```

### Output

One dataset item per page. This item is from a real run of the prefill input on the Apify platform (build 0.1.13, 2 GB, 2026-11-18; later builds changed only this README). The link's signature is cut (shortened):

```json
{
  "fileIndex": 0,
  "url": "https://books.toscrape.com/",
  "input": "url",
  "status": "ok",
  "error": null,
  "finalUrl": "https://books.toscrape.com/",
  "httpStatus": 200,
  "title": "All products | Books to Scrape - Sandbox",
  "format": "png",
  "width": 1280,
  "height": 800,
  "bytes": 151559,
  "fileUrl": "https://api.apify.com/v2/key-value-stores/Vf9FYz9ReTzdVhwij/records/capture-0001.png?signature=…",
  "charged": true,
  "loadMs": 774,
  "capturedAt": "2026-11-18T13:55:26Z"
}
```

| Field | Type | Meaning |
|---|---|---|
| `fileIndex` | number | Position in the run, from 0. The HTML document is 0 when given. The file name uses `fileIndex + 1` (`capture-0001.png`). |
| `url` | string or null | The URL you gave (trimmed, with `https://` added if missing); `null` for your HTML. |
| `input` | string | `url` or `html`. |
| `status` | string | `ok`, `error`, `blocked` or `skipped` (see below). |
| `error` | string or null | Why the page was not captured or not charged. |
| `finalUrl` | string or null | The address after redirects; `null` for your HTML. |
| `httpStatus` | number or null | The page's HTTP status; `null` for your HTML. |
| `title` | string or null | The page title (up to 300 characters). |
| `format` | string or null | `png`, `jpeg` or `pdf`. |
| `width`, `height` | number or null | Image size in pixels: CSS px × pixel density, so a page without a mobile viewport tag can be 2,940 px wide on `mobile`; `null` for PDF. |
| `bytes` | number or null | File size. |
| `fileUrl` | string or null | Signed link to the file in the run's key-value store. It opens without your token, so anyone with the link can open the file. |
| `charged` | boolean | Whether the capture is billable. |
| `loadMs` | number or null | Time from opening the page to the finished capture, in ms. |
| `capturedAt` | string | UTC time of the item. |
| `note` | string | Only present when the filter refused some page resources (private, reserved or unresolvable hosts); lists those hosts. |

When there is no file, `fileUrl`, `format`, `width`, `height` and `bytes` are `null`. The page fields can still be filled, e.g. `httpStatus` of an error answer or `finalUrl` of a redirect blocked by robots.txt. Items appear in the order pages finish; sort by `fileIndex` for the input order. In Console, the Overview view links each file, and the Image previews view shows PNG and JPEG captures inline.

**`status` values:**

- `ok`: the page was captured. It is billable (`charged: true`).
- `error`: not captured, or the page answered with HTTP 4xx/5xx. For an HTTP error the error page is still saved, not charged; if Chromium refuses to render it, there is no file. `error` says why.
- `blocked`: robots.txt does not allow the page, or the site's robots.txt failed (5xx, no answer, or an answer that broke off). A redirect to a site whose robots.txt does not allow it is discarded too. Not charged.
- `skipped`: the charge limit or the run timeout was reached before this page. No file, not charged. After an abort, pages that were not started are not listed.

**Files:** the captures are saved in the run's default key-value store as `capture-0001.png`, `capture-0002.jpg`, `capture-0003.pdf` and so on. This store is unnamed, so it follows Apify's data retention ([Apify docs](https://docs.apify.com/platform/storage/usage)): on the Free plan your 10 most recent runs are kept for 4 months; on paid plans all data follows your plan's retention period; unnamed storages are then deleted. Copy the files you need to keep, or rename the store in Console (named storages are kept).

**Run summary:** the `OUTPUT` record has `pages`, `ok`, `errors`, `skipped` (including robots.txt blocks), `blockedByRobots`, `captures` (charged) and the last 200 `failures`.

### Pricing

| Event | What | Price |
|---|---|---|
| `capture` | The first screen or one element, PNG or JPEG | $0.003 |
| `full-page-capture` | A full page (PNG or JPEG) or a PDF | $0.005 |
| `apify-actor-start` | Apify's start event, at the start of each run: once up to 1 GB of memory, then once per extra GB | $0.00005 each ($0.0001 at the default 2 GB) |

**Paid Apify plans pay less.** Apify Store discounts apply automatically: Bronze 10% off, Silver 20% off, Gold and higher 30% off. The prices above are Free-plan prices; the Store card shows the lowest (Gold) price. The start event (`apify-actor-start`) has no discount.

- **Free:** failed pages, pages that answer HTTP 4xx/5xx, pages blocked by robots.txt, skipped pages. Dataset items are not charged.
- **Element captures** are always `capture`, also with `fullPage` on.
- **Examples:**
  - the prefill input (2 screens): 2 × $0.003 + $0.0001 = **$0.0061**;
  - 1,000 screens in one run: **$3.0001**;
  - 1,000 full pages or PDFs in one run: **$5.0001**.
- **Charge limit:** set a maximum cost per run in the run options (`maxTotalChargeUsd` in the API). No capture starts unless its price still fits. A charge that fails is retried before the run ends; the `OUTPUT` record has the final count.

### Limits

- **Pages per run:** 1,000. Your HTML counts as one page (999 URLs + HTML).
- **HTML:** one document per run, up to 2 MB. Images and styles it links to must be on public URLs.
- **Full-page height:** cut at `maxHeight` CSS px (default 10,000, max 16,000). The image is larger by the pixel density: on `mobile` (3×), `maxHeight` 1,000 gives an image 3,000 px tall, 1,170 px wide for a page with a mobile viewport tag.
- **Pages without a mobile viewport tag** (`<meta name="viewport">`) are laid out 980 CSS px wide on `tablet` and `mobile`, as on a real phone. Their full-page captures keep the whole width: 2,940 px on `mobile`, 1,960 px on `tablet`.
- **Lazy images:** scrolling gives them a chance to load, with no guarantee. Use `delayMs` or `waitForSelector` for slow pages. PDFs get no scrolling.
- **Timeouts:** a page that does not load, or whose `waitForSelector` does not appear, within `pageTimeoutSecs` (30 s) fails with `error`; the other waits (network quiet, `delayMs`, scrolling) are cut short and the page is still captured. Taking the capture has its own limit of at least 30 s. A page whose scripts keep the browser busy is stopped after about 75 s at the defaults. None of these are charged.
- **Run timeout:** shortly before it (60 s, or 20 % of a short timeout, at least 5 s), the Actor starts no new pages and lists the rest as `skipped`. Raise the timeout for long lists.
- **Tabs at the same time** (default, from the run memory, rounded down, 1–6):

  | Memory | Screens and elements (memory ÷ 700 MB) | Full pages and PDF (memory ÷ 1,400 MB) |
  |---|---|---|
  | 1 GB | 1 | 1 |
  | 2 GB (default) | 2 | 1 |
  | 4 GB | 5 | 2 |
  | 8 GB (max) | 6 | 5 |

  `maxConcurrency` (1–10) overrides it.
- **Speed** (measured on Apify with build 0.1.13, 2 GB memory, 2026-11-18, run start included; later builds changed only this README):

  - 2 screens (the prefill): 18 s;
  - 20 screens: 28 s (2 tabs);
  - 10 full pages, PNG, 1,280×1,775 to 2,549 px: 42 s (1 tab);
  - 10 PDFs: 28 s (1 tab).

  These are light test pages (books.toscrape.com, quotes.toscrape.com). Runs of the same inputs on earlier builds that day took 8–20 s, 23–35 s, 41–44 s and 26–30 s, so expect run-to-run differences of up to about 2.4×. Heavy pages take longer. More memory gives more tabs.
- **Run status:** the run ends as SUCCEEDED whenever every page has a row, even if no page could be captured: each row's `status` and `error` say why, and the status message starts with "No page could be captured". Invalid input fails the run with no items.
- **Not supported:** logins and cookies, URLs with `user:password`, protocols other than http and https. Pop-up windows are closed, never captured. `selector` is ignored for PDF, and `maxHeight` does not cut element captures.

### Use it from your stack

No third-party API keys. You need an Apify account; the API, n8n, Make, Zapier and MCP use your Apify token.

- **API** (waits for runs up to 300 s, then answers 408; start a normal run for long lists):
  ```bash
  curl -X POST "https://api.apify.com/v2/acts/klarto~website-screenshot-pdf/run-sync-get-dataset-items" \
    -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
    -d '{"urls": ["https://books.toscrape.com/"]}'
  ```
- **Python** (`pip install apify-client`, version 3):
  ```python
  from apify_client import ApifyClient
  client = ApifyClient("<YOUR_APIFY_TOKEN>")
  run = client.actor("klarto/website-screenshot-pdf").call(run_input={"urls": ["https://books.toscrape.com/"]})
  print([i["fileUrl"] for i in client.dataset(run.default_dataset_id).iterate_items()])
  ```
- **n8n:** the Apify node → Run an Actor, Actor `klarto/website-screenshot-pdf`. Then read `fileUrl` from the dataset items.
- **Make, Zapier:** the Apify app, with the Actor `klarto/website-screenshot-pdf`.
- **MCP / AI agents:** `https://mcp.apify.com?tools=klarto/website-screenshot-pdf`. Each item has `status`, `error` and a direct `fileUrl`.

### FAQ

**Can it capture pages behind a login?** No. There is no login or cookie input, so you get what a logged-out visitor sees.

**Does it get past bot protection or CAPTCHAs?** No. If the site answers with HTTP 403 or 429, the page is free. If it shows a challenge page with HTTP 200, that page is what you get, and it is charged as a capture.

**Does it click "Accept" on cookie banners?** No. It hides 29 common banner containers with CSS. Banners with other markup stay visible, and so can banners on pages whose Content Security Policy blocks the added CSS.

**Why is my page `blocked`?** The site's robots.txt does not allow `KlartoScreenshot` or all bots on that path, or robots.txt failed. If it is your own site, turn off `respectRobotsTxt`.

**Why is my full page cut off?** It is taller than `maxHeight`. Raise it up to 16,000 CSS px.

**How long do the file links work?** Until your plan's data retention removes the run's unnamed key-value store. Copy files you need to keep.

**Can I render many HTML documents?** One per run. Start several runs, or host the files and pass their URLs.

**Can it reach my intranet or localhost?** No. Private, local and reserved addresses are refused. A private URL in your list fails with `error`; refused page resources are listed in the item's `note`.

### Fair use and licences

- Capture only pages you own or may capture, and respect the sites' terms. Keep `respectRobotsTxt` on for sites that are not yours.
- On desktop devices the browser sends Chromium's own user agent with "HeadlessChrome" changed to "Chrome"; on tablet and mobile an iPad or iPhone Safari user agent. Each ends with ` KlartoScreenshot/0.1 (+https://apify.com/klarto)`, so site owners can identify or block it. robots.txt is read as `KlartoScreenshot/0.1 (+https://apify.com/klarto)`.
- No Apify or residential proxies, no CAPTCHA solving, no stealth plugins, no logins.
- Built with Chromium (BSD-style licence plus third-party licences), Playwright for Python (Apache-2.0), the Apify SDK and client (Apache-2.0), HTTPX (BSD-3-Clause) and Protego (BSD-3-Clause).

### Ready-made examples

Saved inputs for common jobs: open one and run it as it is, or change the input first.

- [Take full-page screenshots of websites (PNG)](https://apify.com/klarto/website-screenshot-pdf/examples/full-page-website-screenshot)
- [Convert web pages to PDF (A4, Letter)](https://apify.com/klarto/website-screenshot-pdf/examples/web-page-to-pdf)
- [Capture mobile screenshots of websites](https://apify.com/klarto/website-screenshot-pdf/examples/mobile-website-screenshot)
- [Render your own HTML to a PNG image (Open Graph card)](https://apify.com/klarto/website-screenshot-pdf/examples/html-to-image-og-card)

### Related Actors

- [Website SEO Audit & Broken Link Checker](https://apify.com/klarto/website-seo-audit): audit your own site.
- [PDF & Image OCR to Text and Markdown](https://apify.com/klarto/pdf-ocr-markdown): turn captured PDFs and images into text.
- [Image Upscaler 2x / 4x](https://apify.com/klarto/image-upscaler-cpu): make small images larger and sharper.

### Support

Questions, or a page that fails? Open an issue on the Actor page. We aim to answer within a week.

# Actor input Schema

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

Pages to capture, one per line (up to 1,000 per run). Only pages you own or may capture. Pages that the site's robots.txt does not allow get status 'blocked' and are not charged.

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

Optional: one HTML document of your own (up to 2 MB), e.g. an Open Graph card, invoice or report. It is rendered once per run (fileIndex 0), next to any URLs. Images and styles it links to must be on public URLs.

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

PNG (sharp, larger), JPEG (smaller) or PDF (printable pages).

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

Capture the whole scrollable page, not just the first screen, cut at 'Max full-page height'. For PNG and JPEG the page is first scrolled down one screen at a time (0.15 s per step) so lazy images can start loading; images that load slower may be missing. PDF always prints the whole page.

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

Screen size and type: desktop 1280×800, laptop 1440×900, full HD 1920×1080, tablet 820×1180 (2×), mobile 390×844 (3×).

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

Optional: capture only the first element matching this CSS selector, e.g. 'main' or '#pricing'. It must become visible within 10 s. Ignored for PDF.

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

Hide 29 common cookie-consent banner containers with CSS. Nothing is clicked or accepted; banners with other markup stay visible.

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

Ask the page for its dark color scheme (only pages that support it change).

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

Optional: wait until this element is visible before capturing, within the page timeout. If it does not appear, the page fails with status 'error' and is not charged.

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

Wait this long after the page has loaded (0-10,000 ms), e.g. for animations. Shortened if the page timeout runs out.

## `pageTimeoutSecs` (type: `integer`):

Time budget to load and prepare a page, 5-120 s. A page that does not load, or whose 'Wait for element' does not appear, in time fails with status 'error' and is not charged; network quiet, 'Extra delay' and scrolling are cut short. Taking the capture has its own limit (at least 30 s).

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

Full-page captures are cut at this height in CSS pixels (800-16,000). The image is larger by the pixel density: on mobile (3x) 1,000 gives an image 3,000 px tall. Pages without a mobile viewport tag are laid out 980 CSS px wide on tablet and mobile, and the whole width is kept.

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

Optional: override the device width (200-3,840 px; 0 = device default).

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

Optional: override the device height (200-2,160 px; 0 = device default).

## `scale` (type: `integer`):

Device pixel ratio 1-3 (2 = retina-sharp, 4× the pixels); 0 = device default.

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

10-100 (only for JPEG).

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

Paper size for PDF output.

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

Read each site's robots.txt (user agent 'KlartoScreenshot') before opening a page. Pages it does not allow, or sites whose robots.txt fails (5xx, no answer, broken answer), get status 'blocked' and are free. After a redirect to another site, that site's robots.txt is checked and a disallowed capture is discarded. Turn off only for sites you own.

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

Pages captured at the same time (1-10). Default: run memory / 700 MB for screens and elements, / 1,400 MB for full pages and PDF, rounded down, 1-6 (2 GB: 2 screen tabs or 1 full-page tab).

## Actor input object example

```json
{
  "urls": [
    "https://books.toscrape.com/",
    "https://quotes.toscrape.com/"
  ],
  "format": "png",
  "fullPage": false,
  "device": "desktop",
  "hideCookieBanners": true,
  "darkMode": false,
  "delayMs": 0,
  "pageTimeoutSecs": 30,
  "maxHeight": 10000,
  "viewportWidth": 0,
  "viewportHeight": 0,
  "scale": 0,
  "jpegQuality": 80,
  "pdfFormat": "A4",
  "respectRobotsTxt": true
}
```

# Actor output Schema

## `captures` (type: `string`):

One record per page: status, link to the PNG/JPEG/PDF file, HTTP status, title, size, charged.

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

Pages captured, failed and skipped, captures charged, failure reasons.

# 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://books.toscrape.com/",
        "https://quotes.toscrape.com/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klarto/website-screenshot-pdf").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://books.toscrape.com/",
        "https://quotes.toscrape.com/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klarto/website-screenshot-pdf").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://books.toscrape.com/",
    "https://quotes.toscrape.com/"
  ]
}' |
apify call klarto/website-screenshot-pdf --silent --output-dataset

```

## MCP server setup

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

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/LNSs7YkeYofDn9OjU/builds/5E8dt7bseyF0iRUq8/openapi.json
