---
title: Convert HTML to PDF API
slug: convert-html-to-pdf
url: https://apyhub.com/apyhub/service/convert-html-to-pdf
provider: ApyHub
categories: [Output Kit]
tags: [html-to-pdf, pdf-generation, document-conversion]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 6
atoms: 100
mcp: true
alias: converter-html-pdf
---

# Convert HTML to PDF API

HTML to PDF API for invoices, reports and receipts. Send an HTML file, URL or base64 string and get a PDF download or a signed link. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/link` | What it does Converts a remote HTML file at the given URL into a PDF and returns a signed PDF link.… | 100 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/download` | What it does Converts a base64-encoded HTML file into a PDF and returns the PDF as a download. The… | 100 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/link` | What it does Converts a base64-encoded HTML file into a PDF and returns a signed link to the genera… | 100 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/download` | What it does Uploads an HTML file and returns the generated PDF as a binary download. Query Paramet… | 100 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/link` | What it does Converts an uploaded HTML file into a PDF and returns a signed link to the generated P… | 100 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/download` | What it does Converts a remote HTML file accessible by URL into a PDF download. The request accepts… | 100 |

## Endpoint reference

### Convert remote HTML file URL to PDF signed link

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/link` · 100 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Example: `https://assets.apyhub.com/samples/sample.html`. |

#### Quickstart

Send the HTML page URL you want to convert to PDF.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.html"}'
```

#### What you'll get back

Returns a JSON object with a `data` string field containing a URI for the generated PDF.

```json
{
  "data": "https://example.com/generated.pdf"
}
```

### Convert base64-encoded HTML file to PDF download

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/download` · 100 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `base64` | body | string | yes | Base64-encoded file bytes. |
| `landscape` | query | boolean | no | Default: `false`. |

#### Quickstart

Convert base64-encoded HTML into a PDF download with a single JSON request.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"base64":"PGh0bWw+PGJvZHk+PGgxPkhlbGxvPC9oMT48L2JvZHk+PC9odG1sPg=="}'
```

#### What you'll get back

Returns a binary file response (`string` with `format: binary`), which is the generated PDF content.

```text
(binary PDF data)
```

### Convert base64-encoded HTML file to PDF signed link

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/link` · 100 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `base64` | body | string | yes | Base64-encoded file bytes. |

#### Quickstart

Convert a base64-encoded HTML file into a PDF link by sending the encoded bytes in the request body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/base64/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"base64":"PGh0bWw+PGJvZHk+SGVsbG8sIHBkZjwvYm9keT48L2h0bWw+"}'
```

#### What you'll get back

Returns a JSON object with a `data` string field containing the generated file URI.

```json
{
  "data": "https://example.com/generated-file.pdf"
}
```

### Convert HTML file upload to PDF download

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/download` · 100 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes | .html |
| `output` | query | string | no | Example: `output.pdf`. |
| `landscape` | query | boolean | no | Default: `false`. |

#### Quickstart

Upload an HTML file to download the converted PDF.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/download" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.html"
```

#### What you'll get back

Returns a binary file stream, which is the generated PDF document.

### Convert HTML file upload to PDF signed link

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/link` · 100 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes |  |
| `landscape` | query | boolean | no | Default: `false`. |

#### Quickstart

Upload an HTML file and get back a PDF link; this example also sets the optional `landscape` query flag to `false` by omission.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/file/link" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.html"
```

#### What you'll get back

Returns a JSON object with a `data` string field containing a URI to the generated PDF.

```json
{
  "data": "https://example.com/generated.pdf"
}
```

### Convert remote HTML file URL to PDF download

`POST https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/download` · 100 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Example: `https://assets.apyhub.com/samples/sample.html`. |
| `landscape` | query | boolean | no | Default: `false`. |

#### Quickstart

Download a PDF from a webpage URL by sending the page link in the JSON body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-html-to-pdf/url/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.html"}'
```

#### What you'll get back

Returns a binary PDF file response.

## About

## What it does
The HTML to PDF API converts HTML into PDF documents. Send a remote HTML file `url`, a `base64` string, or upload an `.html` `file` (up to 100MB), and get the result back as a PDF download or as a signed link in `data`.

Download endpoints return the PDF bytes for immediate use, and you can name the file with `output` on file uploads. Link endpoints return a shareable URL for storage or email. Set `landscape=true` on most endpoints for wide tables and dashboards.

Use it for PDF generation from the HTML templates you already have: invoices, receipts, reports, contracts, certificates and archived snapshots. Render the template in your app, call the HTML to PDF API, and attach or store the result. AI agents can call it through ApyHub MCP to produce documents inside a workflow.

Working with a raw HTML string or a live website instead? Use the [HTML String to PDF API](https://apyhub.com/apyhub/service/convert-html-content-to-pdf) or the [Webpage to PDF API](https://apyhub.com/apyhub/service/capture-public-url-as-pdf).

Pairs well with the [Convert Markdown to HTML API](https://apyhub.com/apyhub/service/convert-markdown-to-html) before conversion and the [PDF Watermark API](https://apyhub.com/apyhub/service/apply-watermark-on-pdf) after it, to brand or mark documents as drafts.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/convert-html-to-pdf
