---
canonical: 'https://htmlcsstoimage.com/features/html-to-pdf'
title: 'HTML to PDF API - Convert HTML and CSS to PDF | HTML/CSS to Image'
description: 'Convert HTML and CSS to PDF with a Chromium-based API. Control page size, margins, scale, and print backgrounds while rendering JavaScript, web fonts, and charts.'
---

# Convert HTML and CSS to PDF

Send HTML and CSS to the PDF generation API. Headless Chromium renders the page and returns a PDF URL without requiring you to run browser infrastructure.

## Key capabilities

- Chromium-based rendering
- Exact page size and margins
- PDF URL returned

## How the HTML to PDF API works

Send HTML and CSS to `POST https://hcti.io/v1/image` with `pdf_options`. HTML/CSS to Image (HCTI) renders it in Chromium, so JavaScript, web fonts, charts, and browser-supported layouts work in the generated PDF without a separate document renderer.

## Control the PDF layout

Set the PDF page width, height, scale, print backgrounds, and each margin in the same API request.

```json
{
  "pdf_options": {
    "page_width": "8.5in",
    "page_height": "11in",
    "margins": ["0.4in", "0.4in", "0.4in", "0.4in"],
    "print_background": true
  }
}
```

PDF output is available on supported plans. Check [pricing](https://htmlcsstoimage.com/pricing.md) for current availability.

## MCP Integration

Connect an MCP-compatible client to `https://mcp.hcti.io` with OAuth. The tools use the connected organization's HTML/CSS to Image account, permissions, and plan limits.

- The `create_image` tool accepts HTML and CSS with `pdf_options` and returns the generated PDF URL. Use it to create reports, invoices, certificates, and other documents.

[Read the full MCP docs](https://docs.htmlcsstoimage.com/integrations/mcp/).

## Generate PDFs directly from application data

### Reports and dashboards

Render current metrics, charts, and styled summaries as downloadable PDF reports.

### Invoices and receipts

Merge transaction data into reusable HTML layouts and generate a PDF for every order or payment.

### Certificates and personalized files

Insert recipient data into one HTML design and render a separate PDF for each person.

### Catalogs and one-pagers

Use existing web design tools to create downloadable product sheets, proposals, and reference documents.

## Get started

REST API requests require an HTML/CSS to Image account and should be authenticated from trusted application code. Check the API docs and pricing for current setup instructions, limits, and feature availability.

- [View the full feature page](https://htmlcsstoimage.com/features/html-to-pdf)
- [Browse all features](https://htmlcsstoimage.com/features.md)
- [Start free](https://htmlcsstoimage.com/join)
- [View pricing](https://htmlcsstoimage.com/pricing.md)
- [Read the PDF docs](https://docs.htmlcsstoimage.com/parameters/pdf_options/)
- [Read the MCP docs](https://docs.htmlcsstoimage.com/integrations/mcp/)
