title: how to print .htm files in c#?
body: <p>I can't seem to find a good way to print .htm files in c# using .net 4.0, visual studio 2010 and <strong>windows forms</strong>. When i tried to print it directly, it printed the raw html data instead of printing the "page" itself.</p>
  
  <p>The only way i know to print it, is to use a WebBrowser control.  When i print the document, it doesn't print colors and the page isn't printed correctly.  For example, the edges are not drawn and so on.</p>
  
  <p>Code for Web Browser :</p>
  
  <pre><code>public void Print()
  {
      // Create a WebBrowser instance. 
      WebBrowser webBrowserForPrinting = new WebBrowser();
  
      // Add an event handler that prints the document after it loads.
      webBrowserForPrinting.DocumentCompleted +=
          new WebBrowserDocumentCompletedEventHandler(PrintDocument);
  
      // Set the Url property to load the document.
      webBrowserForPrinting.Url = new Uri(Core.textLog);
  }
  
  private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
  {
      ((WebBrowser)sender).ShowPrintDialog();
      //// Print the document now that it is fully loaded.
      //((WebBrowser)sender).Print();
  
      //// Dispose the WebBrowser now that the task is complete. 
      ((WebBrowser)sender).Dispose();
  }
  </code></pre>
  
  <p>What can i do?</p>
  
  <p>Thank you!</p>