Thanks in Advance !
In my application, I have embedded a WebView2 control inside a WPF usercontrol.
Is there anyway or a workaround that can help me to take a print of the WebView2 control ?
I identified that the current WebView2 pre-release SDK provided by Microsoft does'nt have any thing specific to print functionality.
As a workaround for HTML documents you can inject script that calls the DOM print method. For example if in the following the webview2 is the WPF WebView2 class:
await webview2.CoreWebView2.ExecuteScriptAsync("window.print();");
Otherwise, we have some feature requests regarding printing in WebView2 Feedback, like this:
Controlling the print dialog/window
WebView2 supports printing to PDF with PrintToPdfAsync(path, settings)
:
await webView2.CoreWebView2.PrintToPdfAsync(@"Path/To/File.pdf");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With