MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
449 stars 55 forks source link

Browser's print preview dialog window is not displayed for a hidden browser window control #3361

Open icnocop opened 1 year ago

icnocop commented 1 year ago

Description

The browser's print preview dialog window is not displayed for a hidden browser window control.

It works as expected when using the system's print preview dialog.

Version

SDK: 1.0.1661.34 Runtime: Version 111.0.1661.62 (Official build) (64-bit) Framework: WPF OS: Windows 10 Enterprise x64 22H2 OS Build 19045.2728

Repro Steps

  1. Add a hidden browser control to a WPF window: <wv2:WebView2 Visibility="Hidden" x:Name="browserForPrinting" />

  2. Try to display the browser's print preview dialog: browserForPrinting.CoreWebView2.ShowPrintUI(CoreWebView2PrintDialogKind.Browser);

I expected the browser's print preview dialog to be displayed in a modal popup window.

It works as expected when using the system's print preview dialog: browserForPrinting.CoreWebView2.ShowPrintUI(CoreWebView2PrintDialogKind.System);

image

Thank you.

ajtruckle commented 1 year ago

Yes. I had asked about this. I had to change my GUI logic to prevent using a hidden control. You will probably find several tickets where I mentioned the same thing.

ajtruckle commented 1 year ago

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

Marim99 commented 10 months ago

I'm trying to print webview2 in UWP app when I use _webView.CoreWebView2.ShowPrintUI(CoreWebView2PrintDialogKind.System); it alert me with this message "Check your printer or select another printer. The printer you chose isn't available or isn't installed correctly."

can you help me in this

monica-ch commented 10 months ago

@Marim99 Unfortunately, at the moment its a known limitation that printing in a UWP app is not supported. This is described a bit more in the WebView2 WinUI2 doc.

We are tracking this issue in https://github.com/MicrosoftEdge/WebView2Feedback/issues/3135. Feel free to add any additional feedback there. Thanks!