# Website Screenshot & URL to PDF API (`faisal_ahmed1931/website-screenshot-pdf`) Actor

Full page website screenshots and URL to PDF in bulk. Cookie banners removed automatically, lazy images loaded, sticky headers fixed. PNG, JPEG, WebP or PDF. Failed captures are free.

- **URL**: https://apify.com/faisal_ahmed1931/website-screenshot-pdf.md
- **Developed by:** [saima mohammed](https://apify.com/faisal_ahmed1931) (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 $0.85 / 1,000 screenshot captureds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 & URL to PDF API — full page, no cookie banners, failed captures free

**Website Screenshot & URL to PDF** turns any list of URLs into clean **full page screenshots** (PNG, JPEG, WebP) or **PDF files**, in bulk, via UI, API, schedule or MCP. It **removes cookie banners and consent popups automatically**, scrolls the page so **lazy-loaded images actually appear**, keeps **sticky headers at the top**, and **never charges you for a failed capture**.

Paste URLs → click **Start** → get a dataset with a link to each file. That's it.

### ✨ Why this screenshot API?

| | This Actor | Typical screenshot Actor |
|---|---|---|
| 🍪 Cookie banners / GDPR consent popups | **Clicked away automatically** (300+ consent platforms + fallbacks) | Banner covers the page |
| 🖼️ Lazy-loaded images | **Scrolls first, then captures from the top** | Grey boxes / missing thumbnails |
| 📌 Sticky header / navbar | **Stays at the top** (or "unstick" / "hide") | Header stuck in the middle of the image |
| 📏 Custom height / above-the-fold | **Any width × height, or full page** | Width only |
| 🧩 Capture one element | **CSS selector** | — |
| 📄 URL to PDF | **A4/Letter/…, margins, landscape, single long page** | — |
| 📱 Devices | Desktop, HD, Retina, laptop, iPad, iPhone, Android | Desktop |
| 🌙 Dark mode, locale, time zone | ✅ | — |
| 🚫 Ads & trackers | Optional blocking (EasyList/EasyPrivacy) | — |
| 🪟 Newsletter / membership popups | Closed automatically | Popup in the image |
| 😀 Emojis & Asian scripts | Noto Color Emoji + CJK fonts installed | Empty boxes |
| ⏱️ Pages that never finish loading | Soft waits, hard timeouts, retries | Run hangs for minutes |
| 💸 Failed captures (404, blocked, timeout) | **Free** | Often still billed |

### 🚀 How to take a website screenshot (3 steps)

1. Open the **Input** tab and paste one or more URLs (one per line, or upload a CSV/TXT list).
2. Pick a format (**PNG**, **JPEG**, **WebP** or **PDF**) and a device. The defaults (full page, cookie banners removed, popups closed, lazy content loaded) work for most sites.
3. Click **Start**. Each URL becomes a row in the **Output** tab with a `screenshotUrl` you can open, download or pass to your app.

### 💰 How much does a screenshot cost?

**$0.85 per 1,000 successful captures**, plus Apify platform usage (compute and storage for your run). Failed captures are free.

- One PNG, JPEG or WebP screenshot, or one PDF, is one `screenshot-captured` event ($0.00085).
- Pages that fail (HTTP 404/500, bot-protection page, timeout, blank page, element not found) are listed in the dataset with the reason and are **not charged**.
- You also pay a small Actor start fee ($0.00005 per GB of memory allocated to the run, minimum one event) and the platform usage your run actually consumes. Usage depends on page complexity, image size and the memory you choose.
- You can set **Maximum cost per run** in the run options; the Actor stops cleanly when it's reached.

### 📥 Input example

```json
{
  "urls": [
    { "url": "https://apify.com" },
    { "url": "https://www.bbc.com" },
    { "url": "https://github.com" }
  ],
  "format": "png",
  "fullPage": true,
  "device": "desktop",
  "cookieBanners": "accept",
  "scrollToBottom": true,
  "blockAds": false
}
```

More recipes:

- **Above-the-fold thumbnail for link previews (1200×630 JPEG):** `"fullPage": false, "width": 1200, "height": 630, "format": "jpeg", "quality": 80`
- **Mobile screenshot:** `"device": "mobile"` (iPhone, 3× pixel density, mobile user agent)
- **URL to PDF:** `"format": "pdf", "pdfFormat": "A4", "pdfMargin": "10mm"` — or `"pdfSinglePage": true` for one long page
- **Only the pricing table:** `"selector": "#pricing"`
- **Wait for a chart to render:** `"waitForSelector": ".chart-ready", "delay": 2000`
- **Remove a chat widget:** `"hideSelectors": ["#intercom-container", ".drift-frame-controller"]`
- **HTML to image / HTML to PDF:** put your markup in `"html"`

### 📤 Output example

Every URL produces one dataset row (successful or not), so you always know what happened:

```json
{
  "url": "https://www.theguardian.com/international",
  "status": "SUCCEEDED",
  "screenshotUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/theguardian-com-international-1a2b3c4d5e.png",
  "key": "theguardian-com-international-1a2b3c4d5e.png",
  "format": "png",
  "device": "desktop",
  "finalUrl": "https://www.theguardian.com/international",
  "httpStatus": 200,
  "pageTitle": "News, sport and opinion from the Guardian's global edition",
  "imageWidth": 1440,
  "imageHeight": 16000,
  "fileSizeBytes": 8123456,
  "truncated": true,
  "cookieBanner": { "cmp": "Sourcepoint-frame", "action": "accepted" },
  "popupsClosed": 0,
  "attempts": 1,
  "timings": { "navigationMs": 1900, "consentMs": 650, "scrollMs": 5900, "captureMs": 2300, "totalMs": 12700 }
}
```

A failed row looks like this (and costs nothing):

```json
{ "url": "https://example.com/missing", "status": "FAILED", "errorCode": "HTTP_404", "errorMessage": "The page responded with HTTP 404. Not charged. …", "attempts": 1 }
```

Error codes: `HTTP_4xx/5xx`, `BLOCKED_BY_BOT_PROTECTION`, `TIMEOUT`, `DNS_NOT_RESOLVED`, `CONNECTION_FAILED`, `SSL_ERROR`, `BLANK_PAGE`, `SELECTOR_NOT_FOUND`, `WAIT_FOR_SELECTOR_TIMEOUT`, `CUSTOM_JS_ERROR`, `INVALID_URL`.

The files themselves are in the run's **key-value store**; the Output tab shows a thumbnail table.

### 🔌 Use it as a screenshot API

Run it synchronously and get the dataset back in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/faisal_ahmed1931~website-screenshot-pdf/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls":[{"url":"https://example.com"}],"fullPage":false,"format":"jpeg"}'
```

The response is returned only after every file is stored, so `screenshotUrl` is ready to fetch. You can also use the JavaScript/Python clients, **schedules** (e.g. daily screenshots for website change monitoring), **webhooks**, Make, Zapier, n8n, or the **Apify MCP server** so AI agents (Claude, ChatGPT, Cursor) can "see" web pages.

### 🧠 Who uses website screenshots?

- **SEO & marketing agencies:** client reports, competitor homepages, SERP landing pages
- **Website change monitoring & archiving:** scheduled full-page captures as evidence
- **Link previews & directories:** above-the-fold thumbnails at scale
- **QA & visual regression:** desktop + mobile captures of every release
- **AI agents:** give an LLM a screenshot or a PDF of any page
- **Compliance:** PDF copies of terms, prices and ads as published

### ⚙️ Settings reference (short)

- **Full page / viewport:** full page is cut at *Max full-page height* (default 16,000 px) so infinite-scroll feeds can't explode; `truncated: true` tells you when that happened.
- **Cookie banners:** `accept` (default — clicks "Accept all" like a normal visitor, so the content is always visible), `reject` (privacy-first; some European news sites then show a "subscribe or accept" wall instead of the article), `hide` (no clicks), `off`. Powered by DuckDuckGo's open-source Autoconsent rules, plus fallbacks that click a clearly labelled accept button or hide leftover consent bars.
- **Popups:** newsletter / membership modals are closed by default (`closePopups`).
- **Sticky elements:** `keep` (default), `unstick`, `hide`.
- **Waiting:** `waitUntil` (load / DOM ready / network idle — applied softly so chatty pages can't hang), `delay`, `waitForSelector`, max scroll time.
- **Proxy:** optional Apify Proxy (residential helps on sites that block data-center IPs).

### ❓ FAQ

**Will I be charged if a page fails?** No. Only rows with `status: "SUCCEEDED"` are charged. Failed rows tell you why.

**Why did a site fail with `BLOCKED_BY_BOT_PROTECTION` or HTTP 403?** Some sites refuse automated browsers (Cloudflare challenge, DataDome, explicit bot bans). This Actor waits for ordinary browser checks to finish but does **not** solve CAPTCHAs or disguise itself. You can try a residential proxy; if the site prohibits automated access, respect that.

**The cookie banner is still visible on one site.** Open an issue with the URL — new consent tools appear all the time and we add rules quickly. Meanwhile use `hideSelectors` or `customCss`.

**My page shows a loading spinner.** Add `waitForSelector` for an element that appears when the content is ready, or increase `delay`.

**Can I screenshot pages behind a login?** Not supported. Only capture pages you are allowed to access.

**Is it legal to screenshot websites?** You supply the URLs and are responsible for having the right to capture them and for complying with each site's terms of service, robots rules, copyright and privacy law. Don't use the Actor to collect personal data without a legal basis.

### 🐞 Support

Found a site where the screenshot isn't perfect? Open an issue in the **Issues** tab with the URL and your input — issues are answered quickly, and fixes ship as new builds.

***

Open-source components: [DuckDuckGo Autoconsent](https://github.com/duckduckgo/autoconsent) (MPL-2.0), [Ghostery adblocker](https://github.com/ghostery/adblocker) (MPL-2.0) with EasyList/EasyPrivacy filter lists (downloaded at build time; GPLv3 / CC BY-SA 3.0), [Crawlee](https://crawlee.dev) & [Playwright](https://playwright.dev) (Apache-2.0), [sharp](https://sharp.pixelplumbing.com) (Apache-2.0).

# Actor input Schema

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

Pages to capture. One URL per line, or upload a text/CSV file. URLs without http(s):// get https:// added. Each URL becomes one dataset row with a link to the file. Required unless you use "Raw HTML to render".

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

PNG (lossless), JPEG or WebP (smaller files, use Quality), or PDF (URL to PDF).

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

Capture the whole scrollable page. Turn off to capture only the visible viewport (above the fold), sized by Device / Width / Height.

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

Viewport preset. Mobile and tablet presets also send a mobile user agent and enable touch, so you get the real mobile layout.

## `width` (type: `integer`):

Overrides the device width. Leave empty to use the preset.

## `height` (type: `integer`):

Overrides the device height. With Full page OFF this is the exact image height (e.g. 630 for a social preview).

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

1–100. Ignored for PNG and PDF.

## `cookieBanners` (type: `string`):

How to deal with cookie/GDPR consent popups, using the open-source DuckDuckGo Autoconsent rules for 300+ consent platforms plus a fallback that hides leftovers. 'Accept' clicks 'Accept all' like a normal visitor, so the content is always visible (recommended). 'Reject' clicks 'Reject all' (privacy-first, but some news sites then show a 'subscribe or accept' wall instead of the article). 'Hide' only hides popups without clicking.

## `scrollToBottom` (type: `boolean`):

Scrolls down the page before capturing so lazy-loaded images and sections appear, then scrolls back to the top so sticky headers stay at the top.

## `closePopups` (type: `boolean`):

Closes or hides modal popups (newsletter sign-ups, membership offers, 'subscribe' dialogs) and their dark backdrops.

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

Blocks ads and tracking scripts (EasyList / EasyPrivacy via the open-source Ghostery engine). Cleaner screenshots and faster loads.

## `fixedElements` (type: `string`):

'Keep' captures the page as a visitor sees it from the top. 'Unstick' makes sticky headers/chat widgets scroll with the page so they appear only once. 'Hide' removes all fixed/sticky elements.

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

Emulates prefers-color-scheme: dark (works on sites that support a dark theme).

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

Full-page captures are cut at this height (CSS px) so endless/infinite-scroll pages don't produce giant files or time out. The dataset shows truncated=true when this happens.

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

E.g. `#pricing` or `main article`. Captures just that element. The run fails (free) for a URL where it is not found.

## `thumbnailWidth` (type: `integer`):

Optional. Downscales the final image to this width keeping the aspect ratio (great for thumbnails / link previews).

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

Overrides the preset. 2 = retina-sharp images (4× pixels).

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

When navigation counts as done. 'Page load' stops early once the network has been quiet for a moment (max 10 s), so ad-heavy pages don't stall. 'Network idle' is applied softly (max 10 s).

## `delay` (type: `integer`):

Wait this long after the page is ready (animations, charts, sliders).

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

Wait until this element is visible before capturing, e.g. `.chart-loaded`. Best fix for pages that show a loading spinner.

## `waitForSelectorTimeoutSecs` (type: `integer`):

If the element doesn't appear in time, the URL is retried and then marked failed (free).

## `scrollMaxSecs` (type: `integer`):

Upper limit for lazy-load scrolling, so infinite-scroll pages can't run forever.

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

Elements to hide before capture, e.g. chat widgets `#intercom-container`, promo bars `.announcement`.

## `customCss` (type: `string`):

Injected into every page before capture.

## `customJs` (type: `string`):

Runs in the page right before capture (async allowed), e.g. `document.querySelector('.tab-2').click(); await new Promise(r => setTimeout(r, 500));`

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

Optional. Renders this HTML as an extra item (e.g. invoices, OG cards). Remote CSS/images referenced with absolute URLs are loaded.

## `locale` (type: `string`):

E.g. en-US, de-DE, fr-FR. Affects Accept-Language and site localisation.

## `timezoneId` (type: `string`):

IANA time zone, e.g. Europe/Berlin.

## `userAgent` (type: `string`):

Leave empty to use a current Chrome user agent (or the device's mobile one).

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

Only for PDF output.

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

Only for PDF output.

## `pdfMargin` (type: `string`):

CSS length for all four margins, e.g. 0, 10mm, 0.5in, 20px.

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

Include background colours and images.

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

Screen gives a PDF that looks like the live site.

## `pdfSinglePage` (type: `boolean`):

Put the whole website on one tall PDF page instead of splitting it into A4/Letter pages.

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

By default 404/500 pages are treated as failures and not charged. Turn on to capture (and pay for) them anyway.

## `navigationTimeoutSecs` (type: `integer`):

Max time for the page to load per attempt.

## `maxRetries` (type: `integer`):

Failed attempts are retried automatically. You are never charged for failures.

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

Upper limit for parallel pages. The Actor also caps it by run memory (about 650 MB per full-page/PDF page, 420 MB per viewport page), so give the run more memory for big batches.

## `throttleAnimations` (type: `boolean`):

Draws JavaScript/WebGL animations at ~5 fps instead of 60 while the page loads. The captured image looks the same, but heavy animated pages (3D, canvas, gradients) capture much faster. Turn off only if a page's JS animation must run at full speed before capture.

## `proxyConfiguration` (type: `object`):

Optional. Use Apify Proxy (residential helps on sites that block data centers) or your own proxies.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://www.bbc.com"
    },
    {
      "url": "https://github.com"
    }
  ],
  "format": "png",
  "fullPage": true,
  "device": "desktop",
  "quality": 80,
  "cookieBanners": "accept",
  "scrollToBottom": true,
  "closePopups": true,
  "blockAds": false,
  "fixedElements": "keep",
  "darkMode": false,
  "maxHeight": 16000,
  "waitUntil": "load",
  "delay": 500,
  "waitForSelectorTimeoutSecs": 15,
  "scrollMaxSecs": 10,
  "locale": "en-US",
  "pdfFormat": "A4",
  "pdfLandscape": false,
  "pdfMargin": "10mm",
  "pdfPrintBackground": true,
  "pdfMediaType": "screen",
  "pdfSinglePage": false,
  "captureErrorPages": false,
  "navigationTimeoutSecs": 45,
  "maxRetries": 2,
  "maxConcurrency": 5,
  "throttleAnimations": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Default dataset: one item per URL with status, metadata, and screenshotUrl when the capture succeeded. Failed captures are listed and are not charged.

## `screenshots` (type: `string`):

PNG, JPEG, WebP and PDF files in the run's default key-value store. Each successful dataset row's screenshotUrl points to one of these files.

# 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": [
        {
            "url": "https://apify.com"
        },
        {
            "url": "https://www.bbc.com"
        },
        {
            "url": "https://github.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("faisal_ahmed1931/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": [
        { "url": "https://apify.com" },
        { "url": "https://www.bbc.com" },
        { "url": "https://github.com" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("faisal_ahmed1931/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": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://www.bbc.com"
    },
    {
      "url": "https://github.com"
    }
  ]
}' |
apify call faisal_ahmed1931/website-screenshot-pdf --silent --output-dataset

```

## MCP server setup

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