webbrowser printing

廉价感情. 提交于 2019-11-29 08:18:17

I did it once (sorry, I don't have the application code now), and I did it playing with the register: check this MS article.

I advice you to store somewhere the current values of the keys and restore them after you're done printing.

EDIT

string keyName = @"Software\Microsoft\Internet Explorer\PageSetup";
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) {
    if (key != null) {
          string old_footer = key.GetValue("footer");
          string old_header = key.GetValue("header");
          key.SetValue("footer", "");
          key.SetValue("header", "");
          Print();
          key.SetValue("footer", old_footer);
          key.SetValue("header", old_header);
    }
}

About pages being cut

I'm not sure if I understood correctly what the problem is... in the application I was talking about before, I had the problem of tables being cut in half, so I played with CSS break after property (see also break before) to force page breaks, specifying special styles for the printer media. Hope this helps...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!