Hey folks,
I'm developing a c# application which hosts a WebBrowser control. My
question is regarding printing. I am able to print the html document, but I
don't want to print that page footer which contains the URL and the date.
Is there a way to alter the print template used when I print using the
WebBrowser control?
Here is my print code:
private void btnPrint_Click(object sender, System.EventArgs e)
{
object o = "";
SHDocVw.OLECMDID Print = SHDocVw.OLECMDID.OLECMDID_PRINT;
SHDocVw.OLECMDEXECOPT DontPromptUser =
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER;
if (!IsPrinterEnabled() ) return;
this.axWebBrowser1.ExecWB(Print, DontPromptUser, ref o, ref o);
}
private bool IsPrinterEnabled()
{
int response = (int)
this.axWebBrowser1.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PRINT);
return (response & (int) SHDocVw.OLECMDF.OLECMDF_ENABLED) != 0 ?true :
false;
}
Darren Carter - 28 Oct 2004 16:12 GMT
I think I may have found the answer, for those who are interested:
"How To Change Print Settings for Internet Explorer and WebBrowser Control
Programmatically"
http://support.microsoft.com/default.aspx?scid=kb;en-us;236777
If anyone else has a better suggestion, please post.