static generateNoteTemplatePng(NOTEPath: string, page: number, pngPath: string): Promise<APIResponse<boolean>>;
| Parameter | Type | Description |
|---|---|---|
NOTEPath | string | NOTE file path |
page | number | Page index (starts from 0) |
pngPath | string | Output PNG path (must end with .png) |
APIResponse<boolean>:result === trueindicates generation succeeded
Example
import { PluginFileAPI } from 'sn-plugin-lib';
/**
* Example: generate a background-template PNG.
*/
export async function exampleGenerateNoteTemplatePng() {
const NOTEPath = '/storage/emulated/0/Note/demo.note';
const page = 1;
const pngPath = '/storage/emulated/0/Note/out/template.png';
const res = await PluginFileAPI.generateNoteTemplatePng(NOTEPath, page, pngPath);
if (!res.success) {
throw new Error(res.error?.message ?? 'generateNoteTemplatePng call failed');
}
return res.result;
}