Partager via


CoreWebView2.CapturePreviewAsync Method

Definition

Captures an image of what WebView is displaying.

public System.Threading.Tasks.Task CapturePreviewAsync (Microsoft.Web.WebView2.Core.CoreWebView2CapturePreviewImageFormat imageFormat, System.IO.Stream imageStream);
member this.CapturePreviewAsync : Microsoft.Web.WebView2.Core.CoreWebView2CapturePreviewImageFormat * System.IO.Stream -> System.Threading.Tasks.Task
Public Function CapturePreviewAsync (imageFormat As CoreWebView2CapturePreviewImageFormat, imageStream As Stream) As Task

Parameters

imageFormat
CoreWebView2CapturePreviewImageFormat

The format of the image to be captured.

imageStream
Stream

The stream to which the resulting image binary data is written.

Returns

Remarks

When CapturePreviewAsync finishes writing to the stream, the Invoke method on the provided handler parameter is called. This method fails if called before the first ContentLoading event. For example if this is called in the NavigationStarting event for the first navigation it will fail. For subsequent navigations, the method may not fail, but will not capture an image of a given webpage until the ContentLoading event has been fired for it. Any call to this method prior to that will result in a capture of the page being navigated away from.

Applies to

See also