# Convert HTML content to PDF

**Use case:** 

Turn HTML markup into a polished PDF document with custom margins and page format. Useful for invoices, reports, and automated document rendering pipelines.

## Input

```json
{
  "html": "<!doctype html><html><head><title>Example PDF</title></head><body><h1>Hello from Apify</h1><p>This HTML will be rendered as a PDF.</p></body></html>",
  "url": "https://example.com",
  "fileName": "output.pdf",
  "format": "A4",
  "printBackground": true,
  "landscape": false,
  "margin": {
    "top": "0.4in",
    "right": "0.4in",
    "bottom": "0.4in",
    "left": "0.4in"
  },
  "viewportWidth": 1280,
  "viewportHeight": 720,
  "waitForMillis": 0
}
```

## Output

```json
{
  "fileName": {
    "label": "File name",
    "format": "string"
  },
  "pdfUrl": {
    "label": "PDF download link",
    "format": "string"
  },
  "key": {
    "label": "KVS key",
    "format": "string"
  },
  "bytes": {
    "label": "Bytes",
    "format": "integer"
  },
  "sourceType": {
    "label": "Source type",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  }
}
```

## About this Actor

This example demonstrates how to use [HTML to PDF Converter](https://apify.com/rainminer/html-to-pdf-converter) with a specific input configuration. Visit the [Actor detail page](https://apify.com/rainminer/html-to-pdf-converter) to learn more, explore other use cases, and run it yourself.