> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ensemble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# pdf Operation

> Generate PDF documents from HTML

## Basic Usage

```yaml theme={null}
operations:
  - name: generate
    operation: pdf
    config:
      html: ${render.output}
      filename: report.pdf
```

## Configuration

```yaml theme={null}
config:
  html: string          # HTML content
  filename: string      # Output filename
  format: string        # A4, Letter, etc
  margin: object        # Page margins
```

## Examples

### From HTML

```yaml theme={null}
operations:
  - name: render
    operation: html
    config:
      template: invoice
      data:
        items: ${input.items}

  - name: generate-pdf
    operation: pdf
    config:
      html: ${render.output}
      filename: invoice-${input.id}.pdf
```

### Store in R2

```yaml theme={null}
operations:
  - name: generate
    operation: pdf
    config:
      html: ${render.output}
      filename: report.pdf

  - name: upload
    operation: storage
    config:
      type: r2
      action: put
      key: reports/${input.id}.pdf
      value: ${generate.output}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="html" icon="window" href="/conductor/operations/html">
    Render HTML
  </Card>

  <Card title="email" icon="envelope" href="/conductor/operations/email">
    Email PDFs
  </Card>
</CardGroup>
