# HTML to PDF - Chromium render (private, no retention) (`hushvert/html-to-pdf`) Actor

Render HTML to PDF with a real Chromium print engine - modern CSS, web fonts and SVG come out as a browser prints them. Paste HTML inline (invoices, reports) or pass a file URL. Privacy-first: inputs deleted at conversion end, outputs within an hour, failed runs never charge.

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

## Pricing

$150.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## HTML to PDF - real Chromium render (private, no file retention)

Renders HTML to PDF with a real Chromium print engine, so modern CSS, web
fonts, flexbox/grid layouts, and inline SVG come out the way a browser prints
them - not the way a word processor guesses them. Paste HTML straight into the
input (the generated-invoice case: no hosting step, no temp bucket) or point it
at an .html file URL.

### Why this one

- **Chromium, not a converter library.** The render path is a headless
  Chromium print, the same engine your users' browsers use. CSS that renders in
  Chrome renders here.
- **Inline HTML input.** Most HTML-to-PDF jobs start from *generated* markup
  (invoices, reports, tickets). Paste it directly as the `html` input; no need
  to host the file anywhere first.
- **No file retention.** The input is deleted the moment the conversion
  finishes. The output is kept for about an hour, then deleted. Your documents
  are not stored, mined, or used for anything.
- **Failed runs never charge.** One dataset item per successful conversion;
  a failure produces no item and no charge.

### Input

Either of:

```json
{ "html": "<!doctype html><html><body><h1>Invoice #1042</h1>...</body></html>" }
```

```json
{ "fileUrl": "https://example.com/report.html" }
```

- `html` (string): the HTML to render, passed inline.
- `fileUrl` (string): direct http(s) URL of an .html file, up to 50 MB.
- `fileName` (optional): base name for the output file.
- `maxWaitSeconds` (optional): how long to wait before failing, default 300.

### Output

- The PDF is stored as the `OUTPUT` record of the run's key-value store
  (the dataset row carries its direct `outputUrl`).
- One dataset row per successful conversion: `pair`, `fileName`,
  `outputFileName`, `inputBytes`, `outputBytes`, `durationSeconds`, `outputUrl`.

### Honesty block

- The conversion runs on hushvert's server lane (Gotenberg's Chromium route),
  not inside this actor. Retention: inputs deleted at conversion end, outputs
  auto-deleted after about an hour.
- Self-contained HTML (styles and images inlined, e.g. data: URIs) is the
  reliable input: it renders identically every time. External assets referenced
  by URL may or may not be reachable from the sandboxed render engine; do not
  depend on them.
- Limit: 50 MB per file.

### Who runs it

Built by the hushvert founder. The browser-side conversion engine is MIT open
source (`@hushvert/engine` on npm); formats a browser can convert (images, HEIC,
audio, archives, PDF page ops) are free and client-side at
https://hushvert.com and are deliberately not sold here. Developer API docs:
https://hushvert.com/for-developers

# Actor input Schema

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

The HTML to render. Paste a full document or a fragment; it is rendered by a real Chromium print engine. Use this OR fileUrl.

## `fileUrl` (type: `string`):

Direct http(s) download URL of an .html file. The file is fetched once, converted, and the input is deleted the moment the conversion finishes.

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

Base name for the converted file. Defaults to the name in the URL, or document.pdf for inline HTML.

## `maxWaitSeconds` (type: `integer`):

How long to wait for the conversion before failing. Default 300.

## Actor input object example

```json
{
  "html": "<!doctype html><html><head><style>body{font-family:system-ui;margin:3em}h1{color:#0a6}</style></head><body><h1>Invoice #1042</h1><table border=\"1\" cellpadding=\"6\"><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>File conversions</td><td>1000</td><td>$150.00</td></tr></table></body></html>"
}
```

# Actor output Schema

## `convertedFile` (type: `string`):

The converted file, stored as the OUTPUT record of the run's key-value store.

## `conversions` (type: `string`):

One dataset row per successful conversion: file names, byte counts, duration.

# 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 = {
    "html": "<!doctype html><html><head><style>body{font-family:system-ui;margin:3em}h1{color:#0a6}</style></head><body><h1>Invoice #1042</h1><table border=\"1\" cellpadding=\"6\"><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>File conversions</td><td>1000</td><td>$150.00</td></tr></table></body></html>"
};

// Run the Actor and wait for it to finish
const run = await client.actor("hushvert/html-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 = { "html": "<!doctype html><html><head><style>body{font-family:system-ui;margin:3em}h1{color:#0a6}</style></head><body><h1>Invoice #1042</h1><table border=\"1\" cellpadding=\"6\"><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>File conversions</td><td>1000</td><td>$150.00</td></tr></table></body></html>" }

# Run the Actor and wait for it to finish
run = client.actor("hushvert/html-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 '{
  "html": "<!doctype html><html><head><style>body{font-family:system-ui;margin:3em}h1{color:#0a6}</style></head><body><h1>Invoice #1042</h1><table border=\\"1\\" cellpadding=\\"6\\"><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>File conversions</td><td>1000</td><td>$150.00</td></tr></table></body></html>"
}' |
apify call hushvert/html-to-pdf --silent --output-dataset

```

## MCP server setup

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