I have the IE web control in my app - and I'm using the EXECWB command to print the current page. However, I'm trying to remove the header / footer that is automatically placed on the page.
The only real way I've found to do this so far is by modifying the registry. I'm concerned that my method for doing this will restrict my program if being used by a person with restricted access to a machine (i.e. can't write to the registery).
Any thoughts on whether or not this method is a bad/sloppy way of doing this, or if there is a better/cleaner method? Let me know!
-Falcon
The only real way I've found to do this so far is by modifying the registry. I'm concerned that my method for doing this will restrict my program if being used by a person with restricted access to a machine (i.e. can't write to the registery).
Any thoughts on whether or not this method is a bad/sloppy way of doing this, or if there is a better/cleaner method? Let me know!
Code:
Dim IERegKey As RegistryKey
Dim header, footer As String
IERegKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Explorer\\PageSetup", True)
footer = RegValue.GetValue("footer", 0)
header = RegValue.GetValue("header", 0)
IERegKey.SetValue("footer", "")
IERegKey.SetValue("header", "")
AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT)
' Reset the values after printing is completed
'IERegKey.SetValue("footer", footer)
'IERegKey.SetValue("header", header)
-Falcon