I finally figured out how to print transformed XML without prompting the user or showing an IE window, but now I need to specify a number of copies and possibly other printe
The only method I've had success with is modifying the registry on the fly (and changing them back to not affect anything else).
You can find the settings you need at "Software\Microsoft\Internet Explorer\PageSetup" under CurrentUser.
To change the printer, you can use this:
using System.Management
public static bool SetDefaultPrinter(string defaultPrinter)
{
using (ManagementObjectSearcher objectSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer"))
{
using (ManagementObjectCollection objectCollection = objectSearcher.Get())
{
foreach (ManagementObject mo in objectCollection)
{
if (string.Compare(mo["Name"].ToString(), defaultPrinter, true) == 0)
{
mo.InvokeMethod("SetDefaultPrinter", null, null);
return true;
}
}
}
}
return false;
}
As for the number of copies, you can always put the WebBrowser.Print in a while loop.