You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When our WinForms application needs to show a PDF to the user, it launches it in a different form than the main application form. It creates a Form object and adds a new WebView2 control to it, awaits EnsureCoreWebView2Async on that control, navigates it directly to a PDF URL, then calls Form.Show. Prior to navigation, in the NavigationStarting event, it conditionally sets the HiddenPdfToolbarItems property depending on whether the user should have access to these toolbar items and whether the PDF is being accessed from an internal or external domain.
What we've found is that whether the setting takes effect is unreliable. Sometimes the intended items are hidden in the PDF plugin's toolbar and sometimes they are not. The decision to use NavigationStarting comes from this remark on the CoreWebView2Settings reference page: "Changes to IsGeneralAutofillEnabled and IsPasswordAutosaveEnabled will take effect immediately, while other setting changes made after NavigationStarting event do not apply until the next top-level navigation", but we've found that if we move the assignment before the Navigate call entirely, we see the same behavior.
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
128.0.2739.79
SDK Version
1.0.2739.15
Framework
Winforms
Operating System
Windows 11
OS Version
10.0.22631
Repro steps
Using the attached repro, these steps reliably demonstrate the issue:
Launch the application and let msn.com load
With both checkboxes unchecked, click the "Show PDF In New Form" button
See the window appear and the PDF plugin load with all toolbar items visible
Close the new window
Check both checkboxes to instruct the application to hide the save and print buttons on the next launch
Click the "Show PDF In New Form" button
See the window appear and the PDF plugin load with all toolbar items visible except hide and save
Close the new window
Uncheck both checkboxes
Click the "Show PDF In New Form" button
See the window appear and the PDF plugin load with hide and save toolbar items still hidden
But also, if you just change the states of the checkboxes and relaunch repeatedly, eventually you'll notice that the new settings were not respected (seems nondeterministic).
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered:
What happened?
When our WinForms application needs to show a PDF to the user, it launches it in a different form than the main application form. It creates a Form object and adds a new WebView2 control to it, awaits EnsureCoreWebView2Async on that control, navigates it directly to a PDF URL, then calls Form.Show. Prior to navigation, in the NavigationStarting event, it conditionally sets the HiddenPdfToolbarItems property depending on whether the user should have access to these toolbar items and whether the PDF is being accessed from an internal or external domain.
What we've found is that whether the setting takes effect is unreliable. Sometimes the intended items are hidden in the PDF plugin's toolbar and sometimes they are not. The decision to use NavigationStarting comes from this remark on the CoreWebView2Settings reference page: "Changes to IsGeneralAutofillEnabled and IsPasswordAutosaveEnabled will take effect immediately, while other setting changes made after NavigationStarting event do not apply until the next top-level navigation", but we've found that if we move the assignment before the Navigate call entirely, we see the same behavior.
Repro:
WebView2HiddenPDFToolbarItems.zip
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
128.0.2739.79
SDK Version
1.0.2739.15
Framework
Winforms
Operating System
Windows 11
OS Version
10.0.22631
Repro steps
Using the attached repro, these steps reliably demonstrate the issue:
But also, if you just change the states of the checkboxes and relaunch repeatedly, eventually you'll notice that the new settings were not respected (seems nondeterministic).
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered: