<p>I am using the webbrowser control in winforms and discovered now that background images which I apply with css are not included in the printouts.</p>

<p>Is there a way to make the webbrowser print the background of the displayed document too?</p>

<p>Edit:
Since I wanted to do this programatically, I opted for this solution:</p>

<pre><code>using Microsoft.Win32;

...

RegistryKey regKey = Registry.CurrentUser
                    .OpenSubKey("Software")
                    .OpenSubKey("Microsoft")
                    .OpenSubKey("Internet Explorer")
                    .OpenSubKey("Main");

//Get the current setting so that we can revert it after printjob
var defaultValue = regKey.GetValue("Print_Background");
regKey.SetValue("Print_Background", "yes");

//Do the printing

//Revert the registry key to the original value
regKey.SetValue("Print_Background", defaultValue);
</code></pre>

<p>Another way to handle this might be to just read the value, and notify the user to adjust this himself before printing. I have to agree that tweaking with the registry like this is not a good practice, so I am open for any suggestions.</p>

<p>Thanks for all your feedback</p>

[{'answer_id': 48292, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 0, 'selected': False, 'text': '<p>By default, the browser does not print background images at all. </p>\n\n<p>In Firefox</p>\n\n<pre><code>* File &gt; Page Setup &gt; Check Off "Print Background"\n* File &gt; Print Preview\n</code></pre>\n\n<p>In IE</p>\n\n<pre><code>* Tools &gt; Internet Options &gt; Advanced &gt; Printing\n* Check Off "Print Background Images and Colors"\n</code></pre>\n\n<p>In Opera</p>\n\n<pre><code>* File &gt; Print Options &gt; Check Off "Print Page Background"\n* File &gt; Print Preview (You may have to scroll down/up to see it refresh)\n</code></pre>\n'}, {'answer_id': 51298, 'author': 'Frank Krueger', 'author_id': 338, 'author_profile': 'https://Stackoverflow.com/users/338', 'pm_score': 2, 'selected': True, 'text': "<p>If you're going to go and change an important system setting, make sure to first read the current setting and restore it when you are done.</p>\n\n<p>I consider this <em>very bad</em> practice in the first place, but if you must do it then be kind.</p>\n\n<pre><code>Registry.LocalMachine\n</code></pre>\n\n<p>Also, try changing <code>LocalUser</code> instead of <code>LocalMachine</code> - that way if your app crashes (and it will), then you'll only confounded the user, not everyone who uses the machine.</p>\n"}, {'answer_id': 751459, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>The corresponding HKCU key for this setting is:\nHKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Print_Background</p>\n'}, {'answer_id': 1765873, 'author': 'Master DJon', 'author_id': 214898, 'author_profile': 'https://Stackoverflow.com/users/214898', 'pm_score': 2, 'selected': False, 'text': '<p>Another registry key would be : \nHKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\Print_Background\nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\\PageSetup\\Print_Background</p>\n'}, {'answer_id': 2475422, 'author': 'icliff', 'author_id': 297132, 'author_profile': 'https://Stackoverflow.com/users/297132', 'pm_score': 0, 'selected': False, 'text': '<pre><code>var sh = new ActiveXObject("WScript.Shell");\nkey = "HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Internet Explorer\\\\Main\\\\Print_Background";\nvar defaultValue = sh.RegRead(key); \nsh.RegWrite(key,"yes","REG_SZ");\ndocument.frames[\'detailFrame\'].focus(); \ndocument.frames[\'detailFrame\'].print();\nsh.RegWrite(key,defaultValue,"REG_SZ");  \nreturn false; \n</code></pre>\n'}]
['https://Stackoverflow.com/questions/48278', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4582/']