# Extract Pages

### Overview

This procedure extracts specific **pages** from a document or file. Each extracted page becomes a **separate document** that can be processed independently in your automation.

{% hint style="warning" %}
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>extract pages from {the source}</code></summary>

#### What does it do?

Begins page extraction from the specified document.

#### 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 — Replace **the source** with a reference to a document or file.

#### Example

```
extract pages from the document
```

</details>

<details>

<summary><code>the start page is x</code></summary>

#### What does it do?

Specifies the first page to extract.

#### Where does it go?

Indented under `extract pages from {the source}`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **x** with a page number (1-based index). If not specified, it defaults to the first page.

#### Example

```
the start page is 2
```

</details>

<details>

<summary><code>the end page is y</code></summary>

#### What does it do?

Specifies the last page to extract.

#### Where does it go?

Indented under `extract pages from {the source}`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **y** with a page number (1-based index). If not specified, it defaults to the last page.

#### Example

```
the end page is 5
```

</details>

### Examples

#### 1. Extract Specific Page Range

Extracts pages 3-7 from a document.

```
extract pages from the document where
    the start page is 3
    the end page is 7
```

#### 2. Extract from Start to Specific Page

Extracts from the first page to page 4.

```
extract pages from the document where
    the end page is 4
```

#### 3. Extract from Specific Page to End

Extracts from page 21 to the last page.

```
extract pages from the document where
    the start page is 21
```

#### 4. Extract All Pages

In this example, no start or end pages are specified, so all pages are extracted.

```
extract pages from the document
```


---

# 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/extract-pages.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.
