2

In System Webbrowser, there are 2 print functions

  • WebBrowser.Print -prints the current document without requiring further user input.
  • WebBrowser.ShowPrintDialog - Opens the Internet Explorer Print dialog box

With WebView2, we can show print preview dialog with the below approach Print functionality in WebView2 control

await webview2.CoreWebView2.ExecuteScriptAsync("window.print();");

However, I'm not sure how to perform silent printing (without showing print preview).

Thanks

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
Loch
  • 87
  • 2
  • 13
  • May be you can grap the content as an image and then print that? https://learn.microsoft.com/da-dk/dotnet/api/microsoft.web.webview2.core.corewebview2.capturepreviewasync?view=webview2-dotnet-1.0.1108.44#microsoft-web-webview2-core-corewebview2-capturepreviewasync(microsoft-web-webview2-core-corewebview2capturepreviewimageformat-system-io-stream) – Poul Bak Mar 08 '22 at 09:45

1 Answers1

0

This is the GitHub issue for the silent printing feature:

https://github.com/MicrosoftEdge/WebView2Feedback/issues/1331

A comment from Oct. 6/22 says it's been added as an experimental feature in v1.0.1414:

https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes?tabs=dotnetcsharp#experimental-features

criddell
  • 14,289
  • 9
  • 41
  • 45