title: c# print function hide window
body: <p>I have my main form and then launch a new form.  The new form is in the front.  I send data to the printer which opens a print window popup. (prints to default, no printer to select)  It then defaults back to my first form and I have to do a BringtoFront on the 2nd form after 1ms.  This is an ok fix because it is only a small blip, but is there a way to hide that print window popup all together so that it just prints in the background?</p>
  
  <pre><code>// code to print
  
  PrintDocument prnDocument;
  string printername;              //Get the default printer name.                
  prnDocument = new PrintDocument();
  printername = Convert.ToString(prnDocument.PrinterSettings.PrinterName);
  
  if (string.IsNullOrEmpty(printername))
      throw new Exception("No default printer is set.Printing failed!");               
  
  prnDocument.PrintPage += new PrintPageEventHandler(prnDoc_PrintPage);
  prnDocument.Print();
  </code></pre>