# HTML to PDF Converter (`automation-lab/html-to-pdf-converter`) Actor

Convert HTML content or web pages to PDF documents. Supports raw HTML strings, single URLs, and bulk URL lists. Full control over page size, margins, orientation, headers, and footers.

- **URL**: https://apify.com/automation-lab/html-to-pdf-converter.md
- **Developed by:** [Automation Lab](https://apify.com/automation-lab) (community)
- **Categories:** Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 71 total users, 13 monthly users, 99.4% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 page converteds

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

## HTML to PDF Converter

Convert HTML content and web pages to PDF documents with full control over formatting, margins, headers, footers, and page size. Supports raw HTML strings, single URLs, and bulk URL lists — no API key or login required.

### What does HTML to PDF Converter do?

**HTML to PDF Converter** turns a public web page or HTML string into a PDF using a real Chromium browser (via Playwright). It renders JavaScript, CSS, web fonts, and background images before Chromium creates a print-layout snapshot stored in Apify's key-value store, ready to download or integrate via API.

You can convert:

- 📄 **Raw HTML strings** — paste your own HTML/CSS markup and get a PDF instantly
- 🌐 **Single URLs** — convert any public web page to PDF
- 📋 **Lists of URLs** — batch-convert multiple pages into separate PDF files

Unlike tools that only handle static markup, this actor loads the page in Chromium and offers explicit readiness, selector, and delay controls. PDFs capture the page's print state at conversion time; interactive behavior and animations are not preserved.

### Who is it for?

**Developers and teams automating document workflows:**

- Generate PDF reports, invoices, or statements from HTML templates
- Archive web pages as PDFs for compliance or record-keeping
- Convert dashboards or data visualizations to shareable PDF files

**Content teams and researchers:**

- Save web articles and documentation as PDFs for offline reading
- Capture a snapshot of a web page before it changes
- Convert multiple web pages into PDF for review or distribution

**Business operations teams:**

- Generate branded PDFs from internal HTML pages or email templates
- Archive receipts, invoices, and order confirmations as PDFs
- Automate end-of-month reporting by converting data dashboards to PDF

**QA and testing engineers:**

- Capture a visual record of web pages at a specific point in time
- Generate test reports in PDF format from HTML output

### Why use HTML to PDF Converter?

- ✅ **Full browser rendering** — uses Chromium (Playwright), so all CSS, fonts, and JS-rendered content render correctly
- ✅ **No API key required** — works out of the box on Apify
- ✅ **Reliable batch conversion** — convert up to 20 URLs with isolated browser contexts and bounded concurrency
- ✅ **Full formatting control** — page size (A4, Letter, Legal, Tabloid, etc.), margins, orientation, scale, headers/footers
- ✅ **HTML string support** — paste raw HTML/CSS markup directly without needing a server
- ✅ **Dynamic content support** — wait for specific CSS selectors or add custom delays before PDF generation
- ✅ **Background graphics** — includes background colors, images, and gradients in the output
- ✅ **Full-page PDFs** — optionally capture the entire scrollable page height instead of standard page breaks
- ✅ **PDF stored in key-value store** — each PDF is directly accessible via URL, no extra download steps

### What data can you extract?

Each run produces:

| Output field | Description |
|---|---|
| `pdfKey` | Filename of the PDF in the key-value store (e.g., `output.pdf`) |
| `pdfUrl` | Direct download URL for the PDF |
| `fileSizeKb` | PDF file size in kilobytes |
| `source` | The original URL or "(HTML string)" |
| `success` | Whether the conversion succeeded |
| `durationMs` | Time spent processing this item in milliseconds |
| `errorStage` | Failed phase (`validation`, `navigation`, `selector`, `render`, or `storage`), otherwise `null` |
| `error` | Error message if conversion failed |

PDFs are stored in the run's key-value store and accessible via the Apify API or the Console UI.

### How much does it cost to convert HTML to PDF?

HTML to PDF Converter uses **pay-per-event (PPE) pricing** — you only pay for what you convert.

| Apify plan | Price per page |
|---|---:|
| Free | $0.00575 |
| Bronze | $0.005 |
| Silver | $0.0039 |
| Gold | $0.003 |
| Platinum | $0.002 |
| Diamond | $0.0014 |

Plus a one-time start fee of **$0.005** per run.

#### Calculated cost examples at Free-tier pricing (not event unit prices)

| Use case | Pages | Estimated cost |
|---|---|---|
| Single invoice or report | 1 | ~$0.01 |
| Weekly batch of 10 pages | 10 | ~$0.055 |
| Daily batch of 50 pages | 50 | ~$0.255 |
| Monthly archive of 200 pages | 200 | ~$1.005 |

**Free plan:** With $5 in free credits, you can convert approximately **860 pages** before any paid plan is needed.

### How to convert HTML to PDF

1. Go to the [HTML to PDF Converter](https://apify.com/automation-lab/html-to-pdf-converter) page on Apify Store
2. Click **Try for free**
3. Choose your **Input type**: HTML string, Single URL, or List of URLs
4. Enter your HTML content or URL(s)
5. Set your PDF options: page format, margins, orientation, headers/footers
6. Click **Start** to begin the conversion
7. When the run finishes, find your PDFs in the **Key-value store** tab
8. Download directly or use the PDF URL in your workflow

**Example: Convert a single web page**

```json
{
  "inputType": "url",
  "url": "https://example.com",
  "pageFormat": "A4",
  "printBackground": true
}
```

**Example: Convert raw HTML to PDF with custom margins**

```json
{
  "inputType": "html",
  "html": "<html><body><h1>Invoice #1234</h1><p>Amount: $100.00</p></body></html>",
  "pageFormat": "Letter",
  "marginTop": "20mm",
  "marginBottom": "20mm",
  "marginLeft": "25mm",
  "marginRight": "25mm"
}
```

**Example: Batch-convert multiple URLs**

```json
{
  "inputType": "urls",
  "urls": [
    "https://example.com/page-1",
    "https://example.com/page-2",
    "https://example.com/page-3"
  ],
  "pageFormat": "A4",
  "maxConcurrency": 2,
  "waitUntil": "networkidle",
  "outputFileName": "report"
}
```

### Input parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `inputType` | string | `url` | What to convert: `html`, `url`, or `urls` |
| `html` | string | — | Raw HTML content to convert (when `inputType` is `html`) |
| `url` | string | — | URL to convert (when `inputType` is `url`) |
| `urls` | array | — | Up to 20 public HTTP(S) URLs (when `inputType` is `urls`) |
| `pageFormat` | string | `A4` | Page size: `A4`, `A3`, `A5`, `Letter`, `Legal`, `Tabloid` |
| `landscape` | boolean | `false` | Use landscape orientation |
| `marginTop` | string | `10mm` | Top margin (e.g., `10mm`, `1cm`, `0.5in`) |
| `marginBottom` | string | `10mm` | Bottom margin |
| `marginLeft` | string | `10mm` | Left margin |
| `marginRight` | string | `10mm` | Right margin |
| `printBackground` | boolean | `true` | Include background colors and images |
| `scale` | number | `1` | Page scale factor (0.1–2.0) |
| `displayHeaderFooter` | boolean | `false` | Show header/footer templates |
| `headerTemplate` | string | — | HTML template for page header |
| `footerTemplate` | string | — | HTML template for page footer |
| `waitForSelector` | string | — | CSS selector to wait up to 15 seconds for before PDF generation |
| `failOnSelectorTimeout` | boolean | `false` | Fail an item when its selector does not appear; otherwise warn and continue |
| `waitForTimeout` | integer | `0` | Extra wait time (ms) after readiness and selector checks |
| `waitUntil` | string | `load` | Readiness milestone: `domcontentloaded`, `load`, or `networkidle`. Default `load` does not require background network activity to stop; explicit `networkidle` still requires idle and fails on timeout. |
| `navigationTimeoutSecs` | integer | `60` | Per-item navigation/readiness timeout (5–120 seconds) |
| `maxConcurrency` | integer | `2` | Number of isolated batch items processed at once (1–5) |
| `outputFileName` | string | `output` | Prefix for PDF filenames |
| `fullPage` | boolean | `false` | Capture full scrollable page height |

### Output examples

Each converted page produces one dataset record:

```json
{
  "index": 1,
  "source": "https://example.com",
  "pdfKey": "output.pdf",
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/output.pdf",
  "fileSizeKb": 245.3,
  "success": true,
  "durationMs": 2841,
  "errorStage": null,
  "error": null
}
```

For batch conversions (`inputType: urls`), PDFs are named `{outputFileName}-001.pdf`, `{outputFileName}-002.pdf`, etc. Dataset rows and filenames always follow input order even when pages run concurrently. Invalid or failed URLs produce diagnostic rows and are not charged as converted pages. Partial-success batches finish successfully; if every item fails, the Actor writes all diagnostic rows and then fails the run.

### Tips for best results

- 💡 **Start small**: Test with a single URL before batch-converting many pages
- 🎨 **Background images not showing?** Make sure `printBackground: true` is set
- ⏳ **Dynamic content not loaded?** Choose the appropriate `waitUntil`, use `waitForSelector` for a content marker, or add `waitForTimeout` (e.g., `2000` for 2 seconds). Enable `failOnSelectorTimeout` when missing content must fail the item.
- 📐 **Full-page captures**: Set `fullPage: true` to avoid page breaks and get one continuous PDF
- 📝 **Headers and footers**: Set `displayHeaderFooter: true` and provide HTML templates with `.pageNumber` and `.totalPages` CSS classes
- 💾 **Custom filenames**: Use `outputFileName` to set a descriptive prefix for your PDFs
- 🔢 **Scaling**: Use `scale: 0.8` to fit more content per page, or `scale: 1.2` to increase text size

### Integrations

**HTML to PDF Converter → Google Drive:**
Schedule the actor to convert your weekly reports to PDF, then use a Zapier webhook to save them to Google Drive automatically. Perfect for archiving or sharing with stakeholders who need offline copies.

**HTML to PDF Converter → Email:**
Convert HTML email templates to PDF for preview and approval. Use the PDF URL in a Make (Integromat) workflow to attach it to an email or Slack notification.

**HTML to PDF Converter → Slack notifications:**
Trigger the actor via API after deploying a dashboard update. Send the PDF URL to a Slack channel so your team always has the latest report as a shareable PDF.

**Scheduled page archiving:**
Set a daily cron schedule on Apify to automatically archive web pages that change frequently (product pages, news articles, pricing pages). Each run stores a dated PDF snapshot.

**Invoice generation pipeline:**
Use the HTML string input mode to generate PDFs from invoice HTML templates. Combine with Apify's API to call this actor from your backend after each payment — get a PDF URL in the response to store in your database.

### API usage

Use the Apify API to run HTML to PDF Converter programmatically from your own code.

#### Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('automation-lab/html-to-pdf-converter').call({
  inputType: 'url',
  url: 'https://example.com',
  pageFormat: 'A4',
  printBackground: true,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log('PDF URL:', items[0].pdfUrl);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient(token='YOUR_APIFY_TOKEN')

run = client.actor('automation-lab/html-to-pdf-converter').call(run_input={
    'inputType': 'url',
    'url': 'https://example.com',
    'pageFormat': 'A4',
    'printBackground': True,
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print('PDF URL:', items[0]['pdfUrl'])
```

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/automation-lab~html-to-pdf-converter/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "inputType": "url",
    "url": "https://example.com",
    "pageFormat": "A4",
    "printBackground": true
  }'
```

### Use with AI agents via MCP

HTML to PDF Converter is available as a tool for AI assistants that support the [Model Context Protocol (MCP)](https://docs.apify.com/platform/integrations/mcp).

Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:

#### Setup for Claude Code

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/html-to-pdf-converter"
```

#### Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com?tools=automation-lab/html-to-pdf-converter"
        }
    }
}
```

Your AI assistant will use OAuth to authenticate with your Apify account on first use.

#### Example prompts

Once connected, try asking your AI assistant:

- "Use automation-lab/html-to-pdf-converter to convert https://example.com/invoice to a PDF in Letter format"
- "Convert this HTML invoice template to a PDF with 20mm margins and a footer showing page numbers"
- "Batch-convert these 5 URLs to PDFs: \[list] and store them with the filename prefix 'monthly-report'"

Learn more in the [Apify MCP documentation](https://docs.apify.com/platform/integrations/mcp).

### Legality

Yes, converting publicly accessible web pages to PDF for personal use, archiving, or internal purposes is generally considered legal in most jurisdictions. Always respect the website's `robots.txt` and terms of service. Avoid bulk-converting copyrighted content for redistribution.

HTML to PDF Converter accesses only the URLs and HTML content you provide and does not crawl links. URL mode is designed for anonymously accessible public HTTP(S) pages; this Actor does not accept credentials, cookies, or login sessions. Always ensure you have the right to capture the content you're converting.

### Data handling, retention, and support

The Actor processes only the HTML and URLs supplied in the run. HTML stays inside the run's browser process; URL mode sends ordinary anonymous browser requests to the selected websites. No AI provider, proxy product, paid content API, credential service, or external database receives the input. The Actor stores PDFs in the run key-value store, conversion diagnostics in the run dataset, and operational messages in run logs. Failed operations send sanitized diagnostic input, exceptions, and Actor/build/run IDs to our private GlitchTip service for repair. Secret fields and URL query strings are removed, and reports are retained for 30 days. It creates no separate content cache. Apify storages follow the retention and deletion settings of your Apify account and can be deleted through Apify Console or API controls.

Do not place passwords, session tokens, or other secrets in URLs. For help, use the **Issues** tab on this Actor's Apify Store page and include a reproducible input with sensitive values removed.

### FAQ

**How fast does conversion take?**
A single page typically converts in 5–20 seconds depending on complexity, rendering time, and network conditions. Batch jobs process up to `maxConcurrency` pages in isolated browser contexts (default 2, maximum 5), so total time depends on the slowest pages and your readiness settings.

**How much does it cost per PDF?**
A single conversion costs approximately $0.01 (start fee + one page at FREE tier). Batch runs are more efficient — $0.05 for 10 pages, $0.25 for 50 pages on the free tier. Paid plans offer lower per-page rates (see pricing table above).

**Why is my PDF missing fonts or background colors?**
If fonts are missing, the web page may use custom web fonts that require the full page to load. Try setting `waitForTimeout: 2000` to give fonts time to download. If background colors or images are missing, make sure `printBackground: true` is set.

**Why are some pages blank or showing an error?**
Some sites block headless browsers or require authentication. If a page consistently fails, it may have bot protection. For pages with slow JavaScript rendering, try adding a `waitForSelector` targeting an element that appears after the content loads, or increase `waitForTimeout`.

**Can I convert password-protected pages?**
No — the actor accesses pages as an anonymous user. Password-protected or login-gated pages will show the login screen in the PDF. To convert authenticated pages, you would need to handle authentication separately before passing a session cookie.

**How do I add headers and footers?**
Set `displayHeaderFooter: true` and provide HTML templates in `headerTemplate` and `footerTemplate`. Use CSS class `.pageNumber` for the current page number and `.totalPages` for total pages. Example footer: `<div style="font-size:8px;text-align:center;width:100%">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>`

### Related Actors

- [Markdown ↔ HTML Converter](https://apify.com/automation-lab/markdown-html-converter) — convert web pages to clean Markdown text and back
- [Broken Link Checker](https://apify.com/automation-lab/broken-link-checker) — find and report all broken links on your site
- [Canonical URL Checker](https://apify.com/automation-lab/canonical-url-checker) — validate canonical URLs across a site
- [Accessibility Checker](https://apify.com/automation-lab/accessibility-checker) — check WCAG compliance for web pages
- [Color Contrast Checker](https://apify.com/automation-lab/color-contrast-checker) — validate WCAG 2.1 color contrast ratios
- [Bulk Image Optimizer](https://apify.com/automation-lab/bulk-image-optimizer) — compress and convert images in bulk

# Changelog

This Actor's version history is a separate document: https://apify.com/automation-lab/html-to-pdf-converter/changelog.md

# Actor input Schema

## `inputType` (type: `string`):

Select what to convert: raw HTML string, a single URL, or a list of URLs.

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

Paste the HTML content to convert to PDF. Used when Input type is 'HTML string'.

## `url` (type: `string`):

URL of the web page to convert to PDF. Used when Input type is 'Single URL'.

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

List of up to 20 public HTTP(S) page URLs. Each input produces one dataset row and each successful URL becomes a separate PDF.

## `pageFormat` (type: `string`):

Paper size for the PDF output.

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

Enable landscape (horizontal) orientation. Default is portrait (vertical).

## `marginTop` (type: `string`):

Top margin of the PDF page. Use CSS units: px, mm, cm, in (e.g. '10mm', '1cm', '0.5in').

## `marginBottom` (type: `string`):

Bottom margin of the PDF page. Use CSS units: px, mm, cm, in.

## `marginLeft` (type: `string`):

Left margin of the PDF page. Use CSS units: px, mm, cm, in.

## `marginRight` (type: `string`):

Right margin of the PDF page. Use CSS units: px, mm, cm, in.

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

Include background colors and images in the PDF. Disable for plain text output.

## `scale` (type: `number`):

Scale factor for the web page rendering. 1 = 100% (default), 0.5 = 50%, 2 = 200%.

## `headerTemplate` (type: `string`):

HTML template for page header. Use CSS classes: .pageNumber (current page), .totalPages (total pages), .date, .title, .url. Leave empty for no header.

## `footerTemplate` (type: `string`):

HTML template for page footer. Use CSS classes: .pageNumber, .totalPages, .date, .title, .url. Leave empty for no footer.

## `displayHeaderFooter` (type: `boolean`):

Show header and footer templates. Must be enabled for headerTemplate or footerTemplate to appear.

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

CSS selector to wait for before generating PDF. Useful for pages that load content dynamically. Leave empty to generate immediately.

## `failOnSelectorTimeout` (type: `boolean`):

When enabled, a missing waitForSelector fails that item instead of warning and continuing.

## `waitForTimeout` (type: `integer`):

Additional time to wait after readiness and selector checks before generating the PDF.

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

Navigation milestone required before selector and additional waits begin. Default load waits for the page load event without requiring background requests to stop. Choose networkidle explicitly only for pages whose network activity becomes idle; use waitForSelector for dynamic content.

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

Maximum time for each URL or HTML document to reach the selected readiness milestone.

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

Maximum number of isolated pages converted at once. Applies to URL batches.

## `outputFileName` (type: `string`):

Prefix for the PDF filename stored in key-value store. Files are named {prefix}-{index}.pdf or {prefix}.pdf for single items.

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

Set PDF height to full scrollable page height instead of fixed page format size.

## Actor input object example

```json
{
  "inputType": "url",
  "html": "<h1>Hello, World!</h1><p>This is a PDF generated from HTML.</p>",
  "url": "https://apify.com",
  "urls": [
    "https://apify.com",
    "https://apify.com/store"
  ],
  "pageFormat": "A4",
  "landscape": false,
  "marginTop": "10mm",
  "marginBottom": "10mm",
  "marginLeft": "10mm",
  "marginRight": "10mm",
  "printBackground": true,
  "scale": 1,
  "headerTemplate": "",
  "footerTemplate": "",
  "displayHeaderFooter": false,
  "waitForSelector": "",
  "failOnSelectorTimeout": false,
  "waitForTimeout": 0,
  "waitUntil": "load",
  "navigationTimeoutSecs": 60,
  "maxConcurrency": 2,
  "outputFileName": "output",
  "fullPage": false
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset rows for every submitted HTML or URL source.

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

Key-value store containing each successfully generated PDF.

# 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 = {
    "inputType": "url",
    "html": "<h1>Hello, World!</h1><p>This is a PDF generated from HTML.</p>",
    "url": "https://apify.com",
    "urls": [
        "https://apify.com",
        "https://apify.com/store"
    ],
    "pageFormat": "A4",
    "marginTop": "10mm",
    "marginBottom": "10mm",
    "marginLeft": "10mm",
    "marginRight": "10mm",
    "outputFileName": "output"
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/html-to-pdf-converter").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 = {
    "inputType": "url",
    "html": "<h1>Hello, World!</h1><p>This is a PDF generated from HTML.</p>",
    "url": "https://apify.com",
    "urls": [
        "https://apify.com",
        "https://apify.com/store",
    ],
    "pageFormat": "A4",
    "marginTop": "10mm",
    "marginBottom": "10mm",
    "marginLeft": "10mm",
    "marginRight": "10mm",
    "outputFileName": "output",
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/html-to-pdf-converter").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 '{
  "inputType": "url",
  "html": "<h1>Hello, World!</h1><p>This is a PDF generated from HTML.</p>",
  "url": "https://apify.com",
  "urls": [
    "https://apify.com",
    "https://apify.com/store"
  ],
  "pageFormat": "A4",
  "marginTop": "10mm",
  "marginBottom": "10mm",
  "marginLeft": "10mm",
  "marginRight": "10mm",
  "outputFileName": "output"
}' |
apify call automation-lab/html-to-pdf-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/html-to-pdf-converter"
        }
    }
}
```

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/Exf25YOGtMH25reaz/builds/0vaeLOdH2QXQ8Xv71/openapi.json
