title: How do I programmatically change printer settings with the WebBrowser control?
body: <p>I finally figured out <a href="https://stackoverflow.com/questions/707518/printing-transformed-xml">how to print transformed XML</a> without prompting the user or showing an IE window, but now I need to specify a number of copies and possibly other printer settings. </p>
  
  <p>Is there a way to programmatically change printer settings on a WebBrowser control?</p>
  
  <p>The code in question:</p>
  
  <pre><code>private static void PrintReport(string reportFilename)
  {
      WebBrowser browser = new WebBrowser();
  
      browser.DocumentCompleted += browser_DocumentCompleted;
  
      browser.Navigate(reportFilename);
  }
  
  private static void browser_DocumentCompleted
      (object sender, WebBrowserDocumentCompletedEventArgs e)
  {
      WebBrowser browser = sender as WebBrowser;
  
      if (null == browser)
      {
          return;
      }
  
      browser.Print();
  
      browser.Dispose();
  }
  </code></pre>