Open supperwu opened 1 year ago
Thanks for your detailed issue. 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.
Not sure if it's possible to enhance it like this: 1: Let developer to override the default print behavior 2: Or provide an interface, developer can add customized button in the PDF toolbar Which means developer can implement the print function by themselves.
@supperwu could you please check if suggestions from https://github.com/MicrosoftEdge/WebView2Feedback/issues/2638 are useful for your scenario to disable the default print behavior.
And then you modify/add a print menu in the context menu, and implement the print function using (PrintToPDFAsync API combining with UWP printing APIs to print to a printer).
@monica-ch Thanks for the reply. Yes, we can add a print menu in the context menu. But from the user experience perspective, it's better to trigger the print in the PDF toolbar, so for UWP, the WebView2 will support print PDF in the furture?
@supperwu I agree. Yes, we are planning to support printing in UWP in future, but that is low priority in the backlog. Until then I would recommend you hide the print from the pdf toolbar using HiddenPdfToolbarItems and provide a way to print using our PrintToPdfAsync API.
When will this issue be solved?
@monica-ch Any update on this issue? When will this issue be solved?
Any update?
@pubtom We appreciate your interest in print support for UWP apps. Currently, this feature is a lower priority on our backlog. However, we recommend exploring the suggestions from the thread mentioned above for printing experience using native APIs and WV2 PrintToPDFAsync.
Any update on this issue?
@pubtom Nothing has been changed from our side.
Description
I'm trying to create an UWP app and embed a WebView2 in WinUI 2. Then I try to render a PDF host in a remote server in the WebView2, the PDF can be rendered normally, but when I click the print button in the toolbar, nothing happen and no printing preview dialog display. May I know it's a known issue? Thanks.
Version
SDK: 1.0.1418.22 Runtime: 109.0.1518.52 Framework: UWP WinUI 2.8.1 OS: Win10 20H2
Repro Steps
1: Try to create an UWP app and embed a WebView2 in the main page, follow the guide https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/winui2
2: Render a PDF host in remote server with the WebView2
3: Try to press the print button in the toolbar.