# Website to PDF — Convert Web Pages to PDF in Bulk (`ponderable_hydrometer/url-to-pdf`) Actor

Convert any list of web pages to PDF files with a real Chrome browser. Choose paper size and orientation. Each result links to the stored PDF.

- **URL**: https://apify.com/ponderable_hydrometer/url-to-pdf.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (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 $4.00 / 1,000 results

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 to PDF — Convert Web Pages to PDF in Bulk

**Turn a list of URLs into PDF files.** Each page is rendered in a real Chrome browser and printed to PDF, with the page's own print styles applied.

### What you can do with it

- **Archive pages** such as articles, receipts, documentation or terms of service as PDF files.
- **Save a page as it prints**: the page's own print styles apply, so navigation and ads that the site hides for print stay hidden.
- **Batch conversions**: list many URLs in one run; each page becomes one PDF in the run's key-value store.
- **Create paper-sized files**: A4, Letter, Legal, A3 or Tabloid, portrait or landscape.

### What you get

One row per converted page: `url`, `finalUrl`, `title`, `httpStatus`, `fileUrl` (link to the PDF), `contentType`, `bytes`, `paperFormat`, `landscape`.

### Output sample

```json
{
  "url": "https://example.com/",
  "finalUrl": "https://example.com/",
  "title": "Example Domain",
  "httpStatus": 200,
  "fileUrl": "https://api.apify.com/v2/key-value-stores/abc123/records/page-1.pdf",
  "contentType": "application/pdf",
  "bytes": 24512,
  "paperFormat": "A4",
  "landscape": false
}
```

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | array | — | Pages to convert, e.g. "example.com" or a full URL. |
| `paperFormat` | string | `"A4"` | Paper size of the PDF. |
| `landscape` | boolean | `false` | Use landscape orientation. |
| `printBackground` | boolean | `true` | Include background colors and images. |
| `waitSecs` | integer | `0` | Seconds to wait after the page loads, for late content. |
| `timeoutSecs` | integer | `30` | Give up on a page after this long. |

### Input example

```json
{
  "urls": ["https://en.wikipedia.org/wiki/PDF"],
  "paperFormat": "A4",
  "landscape": false,
  "printBackground": true,
  "waitSecs": 2
}
```

Raise `waitSecs` (0-30) if a page fills in content after it loads; raise `timeoutSecs` (5-120) for slow sites.

### Use it from the API or an AI agent

```bash
curl -X POST "https://api.apify.com/v2/acts/ponderable_hydrometer~url-to-pdf/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://example.com"]}'
```

Each row has `fileUrl`, the link to the stored PDF. Through the Apify MCP server: `https://mcp.apify.com?tools=ponderable_hydrometer/url-to-pdf`.

### How it works

Each page is opened in Chromium (Playwright) in a 1280 x 800 window, waited for until the load event (plus `waitSecs`), and printed to PDF. Pages are processed one after another. Plain domains such as `example.com` are accepted.

### Limits and good to know

- A page that fails, or answers with HTTP 400 or above, produces no row and no result fee. If every URL fails, the run ends as FAILED.
- **Public pages only.** There is no login, no cookies input and no proxy; pages that need them will fail or print the login screen.
- The Actor does not scroll the page, so content that appears only on scroll may be missing; try a longer `waitSecs`.
- Headers and footers (page numbers, date) are not added.
- Sites that block automated browsers may fail. This Actor does not solve CAPTCHAs.
- Files are kept in the run's key-value store for your account's data retention period.

### FAQ

**How big are the PDFs?** The `bytes` field tells you per page. Backgrounds add size; set `printBackground` to `false` for lighter files.

**Can it convert HTML I paste in?** No, only URLs.

### Pricing

Pay per result — **$4.00 per 1,000 results** (one converted page = one result), plus Apify's standard per-run start event ($0.00005 per GB of memory, so a fraction of a cent per run). No subscription.

# Actor input Schema

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

Pages to convert, e.g. "example.com" or a full URL.

## `paperFormat` (type: `string`):

Paper size of the PDF.

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

Use landscape orientation.

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

Include background colors and images.

## `waitSecs` (type: `integer`):

Seconds to wait after the page loads, for late content.

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

Give up on a page after this long.

## Actor input object example

```json
{
  "urls": [
    "https://example.com",
    "https://en.wikipedia.org/wiki/PDF",
    "https://news.ycombinator.com"
  ],
  "paperFormat": "A4",
  "landscape": false,
  "printBackground": true,
  "waitSecs": 0,
  "timeoutSecs": 30
}
```

# Actor output Schema

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

All rows produced by this run, as JSON.

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

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/url-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://example.com",
        "https://en.wikipedia.org/wiki/PDF",
        "https://news.ycombinator.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/url-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://example.com",
    "https://en.wikipedia.org/wiki/PDF",
    "https://news.ycombinator.com"
  ]
}' |
apify call ponderable_hydrometer/url-to-pdf --silent --output-dataset

```

## MCP server setup

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