Skip to content

CdpConnection.captureScreenshot method

CdpConnection › captureScreenshot

Captures a PNG screenshot of this connection's Obsidian window, with the vault path pre-bound.

Pass widthInPixels + heightInPixels to pin the viewport for the duration of the capture, so the emitted PNG is exactly that size whatever size the window happens to be.

Signature:

captureScreenshot(params?: { readonly heightInPixels?: number; readonly widthInPixels?: number; } | undefined): Promise<Uint8Array>

Parameters:

ParameterTypeDescription
params?{ readonly heightInPixels?: number; readonly widthInPixels?: number; } | undefinedThe exact size to capture at. Omit to capture the window at its natural size.

Returns: Promise<Uint8Array>A Promise that resolves to the raw PNG bytes.