title: Printing through PrintQueue job in ASP.NET MVC fails with 0 byte size printed file
body: <p>I tried this example from MSDN in an ASP.NET MVC project:</p>
  
  <pre><code>public void Print(string printQueueName, string printData)
      {
          PrintQueue printerQueue = new LocalPrintServer().GetPrintQueue(printQueueName);
  
          // Call AddJob
          PrintSystemJobInfo myPrintJob = printerQueue.AddJob();
  
          // Write a Byte buffer to the JobStream and close the stream
          Stream myStream = myPrintJob.JobStream;
          Byte[] myByteBuffer = UnicodeEncoding.Unicode.GetBytes(printData);
          myStream.Write(myByteBuffer, 0, myByteBuffer.Length);
          myStream.Close();
      }
  </code></pre>
  
  <p>I tried to print to PDF, XPS and OneNote virtual printers. After confirming printing dialog, printing job appears in printer queue then disappears, and the printed file is created, but with 0 byte size!!!</p>
  
  <p>I don't know where is my fault, and hope to find help here.</p>
  
  <p>Thanks in advance.</p>