> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getCurrentTotalPages

> 获取当前打开文档的总页数。

```ts theme={null}
static getCurrentTotalPages(): Promise<APIResponse<number>>;
```

**返回**

* [`APIResponse<number>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result` 为文档总页数

## 示例

```ts wrap theme={null}
import { PluginDocAPI } from 'sn-plugin-lib';

/**
 * 获取当前文档总页数的示例。
 */
export async function exampleGetCurrentTotalPages() {
  const res = await PluginDocAPI.getCurrentTotalPages();
  if (!res.success) {
    throw new Error(res.error?.message ?? 'getCurrentTotalPages 调用失败');
  }
  return res.result;
}
```
