# PageCollection Object

> Contains all pages in a Text Control document or part of the document.

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

---

### Description

Contains all [pages](https://docs.textcontrol.com/ds-server/reference/javascript/page/llms-full.txt) in a Text Control document or part of the document.

### Syntax

```javascript
PageCollection
```

### Examples

The following example demonstrates `PageCollection` in a practical document-editing workflow. It contains all pages in a Text Control document or part of the document.

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

TXTextControl.pages.getItem(
    function(page) {
        if (!page) {
            console.warn("No page was returned.");
            return;
        }
        
        console.log("get item result:", page);
    },
    onTxError
);
```

---

## In This Section

- [Javascript: PageCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitem-method/llms-full.txt): Gets the Page containing the current text input position from the collection.
- [Javascript: PageCollection.getItemAtTextPosition Method](https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitemattextposition-method/llms-full.txt): Gets the page at a certain text input position.

---

## Nearby

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