# Javascript: PageCollection.getItemAtTextPosition Method

> Gets the page at a certain text input position.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: PageCollection.getItemAtTextPosition Method
- **389 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitemattextposition-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitemattextposition-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitemattextposition-method/llms-full.txt

---

### Description

Gets the page at a certain text input position.

### Syntax

```javascript
<void> PageCollection.getItemAtTextPosition(<Number> textPosition, <RequestPageCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| textPosition | Specifies a zero-based text input position. |
| callback | Receives the page at a certain text input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `PageCollection.getItemAtTextPosition` in a practical document-editing workflow. It gets the page at a certain text input position.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.pages.getItemAtTextPosition(
    -1,
    function(page) {
        if (!page) {
            console.warn("No page was returned.");
            return;
        }
        
        console.log("get item at text position result:", page);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: PageCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitem-method/llms-full.txt)
- **Next:** [PageMargins Object](https://docs.textcontrol.com/ds-server/reference/javascript/pagemargins/llms-full.txt)
