Home > DMT_EditorControl > getCurrentRenderedAreaImage
DMT_EditorControl.getCurrentRenderedAreaImage() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get the canvas rendering region image
Signature
typescript
function getCurrentRenderedAreaImage(tabId?: string): Promise<Blob | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
tabId | string | (Optional) Tab ID. If not passed in, the canvas with the last input focus will be obtained |
Returns
Promise<Blob | undefined>
- Blob-format image data of the canvas rendering region
Example
javascript
// 1. 打开一个原理图页,确定截图的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 获取该画布当前渲染区域的图像
const image = await eda.dmt_EditorControl.getCurrentRenderedAreaImage(tabId);
// 3. 读取 Blob 的基本信息(字节数与 MIME 类型)
console.log('isBlob:', image instanceof Blob);
console.log('size:', image.size);
console.log('mimeType:', image.type);1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11