gpt4 book ai didi

c# - 抑制关于 :blank in Print Output of WinForms WebBrowser

转载 作者:太空狗 更新时间:2023-10-29 23:17:12 26 4
gpt4 key购买 nike

我正在更新一个 WinForms 应用程序,它使用 System.Windows.Forms.WebBrowser 来输出程序生成的一些 HTML 内容。该解决方案工作正常,除了 about:blank 打印在每页的页脚中。

是否可以抑制该输出?或者,是否有一种直接的替代方法可以从没有该问题的 WinForms 打印 HTML?

客户不想假定存在任何第三方软件,例如 Excel 甚至 PDF 阅读器。

最佳答案

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();
}

虽然很傻,但就是这样。

关于c# - 抑制关于 :blank in Print Output of WinForms WebBrowser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8851626/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com