# Javascript: TXTextControl.getPageCount Method

> Gets the number of pages contained in the current document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TXTextControl.getPageCount Method
- **302 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getpagecount-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getpagecount-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getpagecount-method/llms-full.txt

---

### Description

Gets the number of pages contained in the current document.

### Syntax

```javascript
<void> TXTextControl.getPageCount(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the number of pages contained in the current document. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TXTextControl.getPageCount` in a practical document-editing workflow. It gets the number of pages contained in the current document.

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

TXTextControl.getPageCount(
    function(result) {
        console.log("get page count result:", result);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.getLandscape Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getlandscape-method/llms-full.txt)
- **Next:** [Javascript: TXTextControl.getPageUnit Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/getpageunit-method/llms-full.txt)
