# Website to PDF: Convert URLs and HTML to PDF Files (`tidelane/website-to-pdf`) Actor

Turn web pages or your own HTML into PDF files in bulk with a real Chrome browser: A4, Letter and more, landscape, margins, header and footer with page numbers, one long single-page PDF, print or screen styles, cookie banners hidden.

- **URL**: https://apify.com/tidelane/website-to-pdf.md
- **Developed by:** [Tidelane Data](https://apify.com/tidelane) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.20 / 1,000 pdf createds

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 to PDF: Convert URLs and HTML to PDF Files

Turn **web pages** or **your own HTML** into **PDF files** in bulk, rendered by a real Chrome browser, so the PDF looks like the page.

- **Paper PDFs**: A4, Letter, Legal, A3, A5, Tabloid, portrait or landscape, margins, scale, page ranges

- **One long page**: the whole website on a single PDF page, exactly as on screen (great for archiving and design reviews)

- **Header and footer** with page title, date, URL and page numbers (3 / 12)

- **Screen or print styles**: as on the website, or the site's own print version (often without menus and ads)

- **HTML to PDF**: send an invoice, report or certificate template as HTML and get the PDF back

- **Clean pages**: cookie banners hidden (nothing is clicked), lazy-loaded images loaded before printing

- ✅ Real Chromium via Playwright, several pages in parallel

- ✅ Each PDF gets a direct download link

- ✅ Error pages (404, bot blocks) fail and are **not charged**

- ✅ robots.txt respected by default

### Use cases

- **Archiving and compliance**: PDF copies of terms, prices or product pages with date and URL in the footer
- **Reports and invoices**: render your HTML templates to PDF from Make, Zapier, n8n or your own code
- **Reading and sharing**: articles and documentation as PDFs
- **Design and SEO reviews**: one-page PDFs of whole landing pages

### Input examples

Web pages as A4 with header and footer:

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

A whole page on one long PDF page:

```json
{
    "urls": ["https://books.toscrape.com/catalogue/category/books/travel_2/index.html"],
    "singlePage": true,
    "device": "laptop"
}
```

Your own HTML:

```json
{
    "html": "<html><head><title>Invoice 2026-001</title></head><body><h1>Invoice 2026-001</h1>…</body></html>",
    "fileName": "invoice-2026-001",
    "format": "Letter"
}
```

### Output example

Real output from a test run:

```json
{
    "url": "https://quotes.toscrape.com/",
    "source": "url",
    "finalUrl": "https://quotes.toscrape.com/",
    "statusCode": 200,
    "title": "Quotes to Scrape",
    "pdfUrl": "https://api.apify.com/v2/key-value-stores/…/records/quotes-toscrape-com-quotes-to-scrape-caf2b7.pdf",
    "fileName": "quotes-toscrape-com-quotes-to-scrape-caf2b7.pdf",
    "pages": 3,
    "format": "A4",
    "truncated": false,
    "cookieBannerHidden": false,
    "seconds": 1.4
}
```

In the same test the Books to Scrape home page became 6 A4 pages, and a whole category page one single page of 303 KB. `OUTPUT` in the key-value store lists every page with its status.

### Pricing

One event per PDF created. Pages that fail are not charged.

Paid Apify plans pay less: 10% off on Starter, 20% on Scale and 30% on Business and higher plans.

### FAQ

**Pages behind a login?** Not supported; use pages that are publicly visible, or render your own HTML.

**Why does the PDF differ from the screen?** Many sites have print styles. Choose `screen` (the default) to keep the website look, `print` for the print version.

**Very long pages in single-page mode?** Chrome allows at most 14,400 px (200 inches) per PDF page; longer pages are cut there and marked `truncated`. Use paper mode for those.

**Fonts and images in my HTML?** They load from the web like in a browser; use full https:// links.

***

#### Impressum

Levi Griesinger, Tidelane Data\
Besigheimer Straße 18\
74369, Löchgau, Deutschland\
E-Mail: LeviGriesinger@gmail.com

# Actor input Schema

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

Pages to convert, one per line. "example.com" works too (https is added).

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

A complete HTML document (up to 5 MB) to turn into a PDF, for example an invoice or report template. Images and styles may load from the web.

## `fileName` (type: `string`):

Used for the PDF made from your own HTML.

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

Page size of the PDF.

## `landscape` (type: `boolean`):

Wide pages instead of tall ones.

## `singlePage` (type: `boolean`):

The whole site on a single page exactly as wide and tall as on screen (up to 14,400 px tall), no page breaks. Ignores paper size.

## `marginMm` (type: `integer`):

White border on every side.

## `headerFooter` (type: `boolean`):

Page title and date on top; URL and page numbers (3 / 12) at the bottom.

## `media` (type: `string`):

Screen: looks like the website. Print: uses the site's print styles (often without menus and ads).

## `printBackground` (type: `boolean`):

Keep background colors and images.

## `scale` (type: `string`):

Zoom of the content, 0.1 to 2. Below 1 fits more on a page.

## `pageRanges` (type: `string`):

Only these pages, for example 1-3, 5. Empty means all.

## `preferCssPageSize` (type: `boolean`):

If the HTML sets @page { size: ... }, use it instead of the paper size.

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

The browser window the page is laid out for.

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

Hides the consent pop-ups of common tools. Nothing is clicked, no consent is given.

## `scrollToLoad` (type: `boolean`):

Scroll through the page first so lazy-loaded images appear.

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

Wait this long after loading, for animations or late content.

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

networkidle waits until no more requests run (slower, for heavy sites).

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

Skip pages whose robots.txt forbids automated access. Turn off only for your own sites or with the owner's permission.

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

Pages that take longer fail and are not charged.

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

More is faster but needs more memory (about 500 MB per page).

## Actor input object example

```json
{
  "urls": [
    "https://books.toscrape.com/"
  ],
  "format": "A4",
  "landscape": false,
  "singlePage": false,
  "marginMm": 10,
  "headerFooter": false,
  "media": "screen",
  "printBackground": true,
  "scale": "1",
  "preferCssPageSize": false,
  "device": "desktop",
  "hideCookieBanners": true,
  "scrollToLoad": true,
  "delayMs": 500,
  "waitUntil": "load",
  "respectRobotsTxt": true,
  "timeoutSecs": 60,
  "maxConcurrency": 3
}
```

# Actor output Schema

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

All results of the run as dataset items.

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

Summary per input with status (ok, error and the reason).

# 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/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidelane/website-to-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/"] }

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

```

## MCP server setup

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