Skip to content

DesktopCdpTransport.captureScreenshot method

DesktopCdpTransport › captureScreenshot

Captures a PNG screenshot of the Obsidian window showing the given vault.

When a size is requested the viewport is pinned to it with Emulation.setDeviceMetricsOverride for the duration of the capture, so the emitted PNG is exactly that size whatever size the window happens to be — and the override is always cleared afterwards, including when the capture throws, so a failed capture cannot leave the window stuck at the override.

Signature:

captureScreenshot(params: CaptureScreenshotParams): Promise<Uint8Array>

Parameters:

ParameterTypeDescription
paramsCaptureScreenshotParamsWhich vault window to capture, and the exact size to capture it at.

Returns: Promise<Uint8Array>The raw PNG bytes.