private async void Button_Click(object sender, RoutedEventArgs e) { string width = await WebViewPage.InvokeScriptAsync("eval", new[] { "document.body.scrollWidth.toString()" }); string height = await WebViewPage.InvokeScriptAsync("eval", new[] { "document.body.scrollHeight.toString()" }); RenderTargetBitmap rtb = new RenderTargetBitmap(); await rtb.RenderAsync(WebViewPage); var pixelBuffer = await rtb.GetPixelsAsync(); var pixels = pixelBuffer.ToArray(); var displayInformation = DisplayInformation.GetForCurrentView(); var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("goodImage" + ".png", CreationCollisionOption.ReplaceExisting); using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite)) { var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream); encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied, (uint)rtb.PixelWidth, (uint)rtb.PixelHeight, displayInformation.RawDpiX, displayInformation.RawDpiY, pixels); await encoder.FlushAsync(); } }