# Merge Pages into Document

### Overview

This procedure takes multiple page documents (typically individual pages extracted from a larger document) and combines them into a single merged document. Each page maintains its original order and content, creating a complete document from fragmented page files.

{% hint style="info" %}
Make sure to add the **Document Processing Book** to your agent before using this automation procedure.
{% endhint %}

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>merge pages into document</code></summary>

#### What does it do?

Begins the page merging process.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Use this phrase to start merging page documents.

#### Example

```
merge pages into document
```

</details>

<details>

<summary><code>the pages are {page_list}</code></summary>

#### What does it do?

Specifies the list of page documents to merge.

#### Where does it go?

Indented under `merge pages into document`.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace {page\_list} with a reference to a list of page documents.

#### Example

```
the pages are the extracted pages
```

</details>

<details>

<summary><code>the document name is {name}</code></summary>

#### What does it do?

Specifies a custom name for the merged document.

#### Where does it go?

Indented under `merge pages into document`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace {name} with your desired filename (with or without extension).

#### Example

```
the document name is "merged_report.pdf"
```

</details>

### Examples

#### 1. Merge Extracted Pages

Merges pages that were previously extracted from a document.

```
merge pages into document where
    the pages are the extracted pages
    the document name is "complete_report.pdf"
```

#### 2. Merge Pages with Auto-Naming

Merges pages using an automatically generated document name.

```
merge pages into document where
    the pages are the page documents
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/automation-areas/llm/automation-procedures/merge-pages-into-document.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
