title: Generate a screenshot from an html page on Windows Azure
body: <p>I'm trying to generate a screenshot from a html page on windows Azure.
  This is the code I was using on my personal IIS and I know it works on every test machine.</p>
  
  <pre><code>using System.Drawing;
  using System.Drawing.Imaging;
  using System.Linq;
  using System.Text;
  using System.Threading;
  using System.Windows.Forms;
  
  class Program
  {
      static void Main(string[] args)
      {
          new WebsiteToImage("http://www.google.com", "C:\\screenshot.jpg");
      }
  
      // Define other methods and classes here
      public class WebsiteToImage
      {
          internal string _url;
          internal string _fileName;
  
          public WebsiteToImage(string url, string fileName)
          {
              _url = url;
              _fileName = fileName;
  
              // Thread 
              var thread = new Thread(Generate);
              thread.SetApartmentState(ApartmentState.STA);
              thread.Start();
              thread.Join();
          }
  
          private void Generate()
          {
              using (var browser = new WebBrowser { ScrollBarsEnabled = false })
              {
                  browser.Navigate(_url);
                  browser.DocumentCompleted += WebBrowser_DocumentCompleted;
  
                  while (browser.ReadyState != WebBrowserReadyState.Complete)
                  {
                      Application.DoEvents();
                  }
  
                  browser.Dispose();
              }
          }
  
          private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
          {
              // Capture 
              using (var bmp = new Bitmap(1280, 800))
              {
                  var browser = (WebBrowser)sender;
                  browser.ClientSize = new Size(1280, 800);
                  browser.ScrollBarsEnabled = false;
                  browser.BringToFront();
                  browser.DrawToBitmap(bmp, browser.Bounds);
  
                  var encoderParameters = new EncoderParameters(1);
                  encoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
                  bmp.Save(_fileName, ImageCodecInfo.GetImageDecoders().FirstOrDefault(c =&gt; c.FormatID.Equals(ImageFormat.Jpeg.Guid)), encoderParameters);
              }
          }
      }
  }
  </code></pre>
  
  <p>Now, on Azure I know I can't use GDI+ and I'm pretty sure I can't also use WebBrowser.
  Any idea or alternative solution? Even third part component.</p>