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

# Content parts

> Specify one or more content sources to render into a single PDF document

The `parts` parameter allows you to define the content sources that will be rendered into your PDF document.

## Overview

When generating a PDF, you need to specify what content to render. The `parts` parameter accepts an array of content sources, which can be URLs, HTML strings, or structured content objects. These sources are rendered sequentially into a single PDF document.

## Parameter details

<ResponseField name="parts" type="array" required>
  Defines the content sources that will be rendered into your PDF document

  Min items: 1

  Max items: 50

  Item types: URL string, HTML string, or content object

  <Expandable title="Content Object Properties">
    <ResponseField name="type" type="enum<string>" required>
      The type of content

      Available options: `url`, `html`, `template`
    </ResponseField>

    <ResponseField name="content" type="string | object" required>
      The actual content to render. For `url` and `html` types, this is a string. For `template` type, this is an object with `template_id` and optional `context` properties.
    </ResponseField>
  </Expandable>
</ResponseField>

## Usage

```javascript theme={null}
{
  "parts": [
    "https://example.com",
    "<h1>Hello World</h1>",
    {
      "type": "html",
      "content": "<div>Structured HTML content</div>"
    },
    {
      "type": "template",
      "content": {
        "template_id": "invoice_template",
        "context": {
          "customer_name": "Acme Inc."
        }
      }
    }
  ]
}
```

## Behavior

The `parts` parameter accepts three types of content:

1. **URL strings**: Publicly accessible URLs that return HTML content.
2. **HTML strings**: Raw HTML content that starts with a valid HTML tag.
3. **Content objects**: Structured objects with `type` and `content` fields. The content object can be:
   * URL content with `type: "url"`
   * HTML content with `type: "html"`
   * Template content with `type: "template"` (see the [Templates](/features/content-handling/templates) page for details)

Each content part is rendered sequentially in the order provided, creating a multi-page PDF where each part typically starts on a new page.

## Use cases

This parameter is particularly useful for:

1. **Multi-source documents**: Combine content from multiple webpages into a single PDF.

2. **Mixed content types**: Blend web content with custom HTML in the same document.

3. **Report generation**: Create comprehensive reports by combining dynamic web content with static templates.

4. **Document assembly**: Build documents from multiple components stored in different locations.

5. **Dynamic content injection**: Use templates with context data to generate personalized documents.

## Examples

### Single URL

```javascript theme={null}
{
  "parts": ["https://example.com"]
}
```

### Multiple URLs

```javascript theme={null}
{
  "parts": [
    "https://example.com/cover",
    "https://example.com/chapter1",
    "https://example.com/chapter2"
  ]
}
```

### Mixing URLs and HTML

```javascript theme={null}
{
  "parts": [
    "https://example.com/header",
    "<h1>Custom Content</h1><p>This is inserted between web pages.</p>",
    "https://example.com/footer"
  ]
}
```

### Using structured content objects

```javascript theme={null}
{
  "parts": [
    {
      "type": "url",
      "content": "https://example.com"
    },
    {
      "type": "html",
      "content": "<div>Custom HTML content</div>"
    },
    {
      "type": "template",
      "content": {
        "template_id": "invoice_template",
        "context": {
          "customer_name": "Acme Inc.",
          "invoice_number": "INV-2023-001"
        }
      }
    }
  ]
}
```

For more details on using templates, see the [Templates](/features/content-handling/templates) documentation.
