I'm updating a WinForms application that uses System.Windows.Forms.WebBrowser to output some HTML content generated by the program. The solution works fine, except that about:blank
is printed in the footer of each page.
Is it possible to suppress that output? Alternatively, is there a straightforward alternative for printing HTML from WinForms that does not have that issue?
The client does not want to assume the presence of any third-party software such as Excel or even a PDF reader.
public void ClearBrowserPrintHeaderAndFooter()
{
string path = "Software\\\\Microsoft\\\\Internet Explorer\\\\PageSetup";
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(path, true);
if (key == null) {
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(path, true);
}
key.SetValue("header", "");
key.SetValue("footer", "");
key.Close();
}
Silly but it's the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With