title: How to Convert a Stream to MemoryStream
body: <p>In My code try:</p>
  
  <p><img src="https://i.stack.imgur.com/ULAj0.png" alt="data expected"></p>
  
  <p>Stream Content</p>
  
  <pre><code>engine.SetDocument((MemoryStream)content); //No work
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>var a = new MemoryStream();
  engine.SetDocument(content.CopyTo(a)); //Error 
  </code></pre>