燮preSS有关:在web浏览器的WinForms打印输出空白空白、浏览器、preSS、web

2023-09-03 05:06:50 作者:九音引魂箫

我更新使用System.Windows.Forms.WebBrowser输出由程序生成一些HTML内容的WinForms应用程序。该解决方案工作正常,但有关:空白打印在每一页的页脚

是否有可能燮preSS的输出?另外,有来自不具有该问题的WinForms打印HTML一个简单的方法吗?

客户端不希望承担任何第三方软件如Excel,甚至是PDF阅读器presence。

解决方案

 公共无效ClearBrowserPrintHeaderAndFooter()
{
    字符串路径=软件\\\\微软\\\\ Internet Explorer的\\\\对于PageSetup;
    Microsoft.Win32.RegistryKey键= Microsoft.Win32.Registry.CurrentUser.OpenSubKey(路径,真实);
    如果(关键== NULL){
        键= Microsoft.Win32.Registry.LocalMachine.OpenSubKey(路径,真实);
    }
    key.SetValue(头,);
    key.SetValue(页脚,);
    key.Close();
}
 

愚蠢的,但它的方式。

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.

oprea浏览器网页图片问题

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.

 
精彩推荐
图片推荐