How can I disable printing preview header and footer?
I tried set WVBrowser1.CoreWebView2PrintSettings.ShouldPrintHeaderAndFooter to false but did not work.
Thanks
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Print preview header and footer
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Print preview header and footer
Hi,
The ICoreWebView2PrintSettings properties are only used with PrintToPdf and not with Print.
https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2printsettings?view=webview2-1.0.1210.39
As you can see in the feedback repository, there are some unresolved issues with ICoreWebView2PrintSettings like this one :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/2093
The ICoreWebView2PrintSettings properties are only used with PrintToPdf and not with Print.
https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2printsettings?view=webview2-1.0.1210.39
As you can see in the feedback repository, there are some unresolved issues with ICoreWebView2PrintSettings like this one :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/2093
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Print preview header and footer
The TWVBrowser.Print function doesn't exist in the WebView2 API and it's just executing window.print(); in JavaScript.
Read this to add a header and a title using HTML, CSS and JavaScript :
https://stackoverflow.com/questions/1360869/how-to-use-html-to-print-header-and-footer-on-every-printed-page-of-a-document
Read this to add a header and a title using HTML, CSS and JavaScript :
https://stackoverflow.com/questions/1360869/how-to-use-html-to-print-header-and-footer-on-every-printed-page-of-a-document
Re: Print preview header and footer
salvadordf thanks for the tip with the stackoverflow link.
I just didn't notice this simple detail "Settings used by the PrintToPdf method."
I just didn't notice this simple detail "Settings used by the PrintToPdf method."