How can I capture the whole page to a picture while browsing website with WebView2?

cm 1 Reputation point
2021-12-19T09:43:26.173+00:00

By now ,I can only capture the current window to a picture by the codes like this:

Dim ImageStream As Stream = New FileStream("d:\ttt.png", FileMode.OpenOrCreate, FileAccess.Write)
WebView21.CoreWebView2.CapturePreviewAsync(Microsoft.Web.WebView2.Core.CoreWebView2CapturePreviewImageFormat.Png, ImageStream)

Can anybody tell me how to capture the whole page to a picture?Thanks!

Developer technologies | VB
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2021-12-20T03:24:10.193+00:00

    Hi @cm ,
    There's a DevTools Protocol method for that: Page.captureScreenshot
    You can refer to this issue to use it.
    https://github.com/MicrosoftEdge/WebView2Feedback/issues/733
    Hope the above content can be helpful to you.
    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.