Web Browser Printing

Hi
I am using # WPF WebBrowser C control to show the HTML file in my local machine, I added the print function in my application by executing the print command WebBrowser control, but the default behavior of Internet Explorer is to print the url file at the bottom of the screen, can I enable print header and footer for my control? Be able to control WebBrowser for preview? Sometimes a printed page is printed, maybe someone will help to understand what the problem is.
Many thanks!!!

+3
source share
1 answer

(, ), , : MS.

- . ​​

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

, , ... , , , CSS break after (. break before), , . , ...

+14

Source: https://habr.com/ru/post/1715875/


All Articles