Search This Blog

Monday, January 27, 2014

How To Programmatically Change Printer Settings for Internet Explorer and WebBrowser Control in C#

C# > Forms >  WebBrowser > ShowPrintPreviewDialog

How To Programmatically Change Printer Settings for Internet Explorer and WebBrowser Control in C#

Example:

Change margin right property.





string strKey = "Software\\Microsoft\\Internet Explorer\\PageSetup";
bool boolWritable = true;
string strName = "margin_right";
object oValue = "0";
RegistryKey oKey = Registry.CurrentUser.OpenSubKey(strKey, boolWritable);
oKey.SetValue(strName, oValue);
oKey.Close();

webBrowser1.ShowPrintPreviewDialog();