title: How do I keep a stream open from model to controller?
body: <p>I am editing a pdf then print in a new tab. I am getting an error saying I "Cannot access a closed stream." This is what I have thus far...</p>
  
  <p>CONTROLLER</p>
  
  <pre><code>public ActionResult QST(string ID) 
  {   
      ...
      PdfReader reader = new PdfReader(Server.MapPath("~/Content/PDF/QST.pdf"));
      QstRepository repo = new QstRepository();
      Stream newPdf = repo.GS(ID, reader);            
      return new FileStreamResult(newPdf, "application/pdf");
  }
  </code></pre>
  
  <p>MODEL</p>
  
  <pre><code>public Stream GS(string ID, PdfReader reader)
  {
      Stream newPdf = new MemoryStream();
      using (MemoryStream ms = new MemoryStream())
      {
          PdfStamper formFiller = new PdfStamper(reader, ms);
          AcroFields formFields = formFiller.AcroFields;
          formFields.SetField("ID", ID);
  
          formFiller.FormFlattening = true;
          formFiller.Writer.CloseStream = false;
          newPdf = ms;
          formFiller.Close();
      }
      return newPdf;
  }
  </code></pre>
  
  <p>How do I access the pdf before it is closed... or how do I access the pdf after?</p>