> ## 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.

# generateCurrentDocImage

> Generate a PNG image for a specified page of the current document.

```ts wrap theme={null}
static generateCurrentDocImage(
  page: number,
  pngPath: string,
  size: Size,
  type: number
): Promise<APIResponse<boolean>>;
```

**Parameters**

| Parameter | Type                                                    | Description                                                                                                                                                     |
| --------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `page`    | `number`                                                | Page index (starts from `0`)                                                                                                                                    |
| `pngPath` | `string`                                                | Output PNG path                                                                                                                                                 |
| `size`    | [`Size`](/en/api-reference/supernote-plugin/types/size) | Output image size. Both `width` and `height` must be integers in the range `1-5120`                                                                             |
| `type`    | `number`                                                | Image generation type: `0` generates the default image without text-selection styles; `1` includes text-selection information such as highlights and underlines |

**Returns**

* [`APIResponse<boolean>`](/en/api-reference/supernote-plugin/types/api-response):
  `result === true` indicates generation succeeded

## Example

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

/**
 * Example: generate a PNG image for a specified page of the current document.
 */
export async function exampleGenerateCurrentDocImage() {
 const page = 0;
 const pngPath = '/storage/emulated/0/Download/current-doc-page-0.png';
 const size: Size = { width: 1080, height: 1440 };
 const type = 0;

 console.log('generateCurrentDocImage params:', { page, pngPath, size, type });
 const res = await PluginDocAPI.generateCurrentDocImage(page, pngPath, size, type);
 if (!res.success) {
 throw new Error(res.error?.message ?? 'generateCurrentDocImage call failed');
 }
 console.log('generateCurrentDocImage result:', res.result);
 return res.result;
}
```
