I\'m trying to print the contents of a WPF WebBrowser control so that no print dialog is shown, but am having no luck.
I have tried the following and am sure it did
To avoid taking a dependency on MSHTML you can simply do:
browser.InvokeScript("execScript", new object[] { "window.print();", "JavaScript" });
I devised the above solution when I was having trouble with a WPF project that was migrated to .Net Core 3 and was using Tony's answer that involves MSHTML reference. Referencing MSHTML in .Net Core is not very straightforward (see this github issue)