Article ID: 236777 - View products that this article applies to.
This article was previously published under Q236777
This article explains how to set page margins, header and footer information, and the default printer for printing from Internet Explorer and the WebBrowser control programmatically.
Users can easily change page margins, header and footer settings, and the default Internet Explorer printer through the Internet Explorer user interface. However, there are no methods under Internet Explorer or the WebBrowser control to change these settings programmatically.
You cannot use the ExecWB command to set page margins and the header or footer. These values are stored in the registry.
There might be a need to change the print settings of Internet Explorer or the WebBrowser control programmatically. The only settings that can be changed are page margins, and header and footer information. There is no supported way to change other settings like page orientation or printer.
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/322756/ )How to back up and restore the registry in Windows
This is how Microsoft Internet Explorer accesses the printing settings:
For Page Margins, Microsoft Internet Explorer first tries to get the values from this registry key:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetupIf there is no such a key, Internet Explorer create this key by copying the values from the following:
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\PageSetupIf there is no such key, default values are provided.
For the Header and Footer, the values are picked up from the following:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetupIf there is no such key, default values are provided.
The defaults are 0.75 for margins,
For the Internet Explorer default printer, default values are provided from:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\printerThe developer could alter the above registry entries for the printing settings accordingly.
Please note that these values are system-wide and affect all instances of the WebBrowser control and Internet Explorer for the current user.
For a Microsoft Visual Basic .NET version of this article, see 311280For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/145679/EN-US/ )How To Use the Registry API to Save and Retrieve Setting
(http://support.microsoft.com/kb/156732/EN-US/ )How To Print from the Microsoft WebBrowser Control
(http://support.microsoft.com/kb/176400/EN-US/ )How To Print the WebBrowser Control
(http://support.microsoft.com/kb/188271/EN-US/ )How To Print Contents of the Web Browser Control From VB
256898For additional information, visit the following Microsoft Developer Network (MSDN) Web site:
(http://support.microsoft.com/kb/256898/EN-US/ )Default Printer for Internet Explorer or Outlook Express May Be Incorrect
Article ID: 236777 - Last Review: June 15, 2012 - Revision: 3.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.