title: how to save pdf file in client machine in mvc3?
body: <p>I generate a pdf file on the fly and save it to the server side but i need to save it to the client machine. How to achieve this..</p>
  
  <pre><code> Document doc = new Document();
   MemoryStream memoryStream = new MemoryStream();
   string PDFName = ProjectName + ".pdf";
   PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("~/ProjectFiles") + "/" + 
   PDFName, FileMode.Create));
   doc.Open();
         //PDF Content
   doc.Close();
  
   Response.ContentType = "application/pdf";
   Response.AddHeader("content-disposition", "attachment;filename=" + PDFName);
   Response.Buffer = true;
   Response.Clear();
   Response.OutputStream.Write(memoryStream.GetBuffer(), 0, memoryStream.GetBuffer().Length);
   Response.OutputStream.Flush();
   Response.End();
  
       In Response.OutputStream.Write(memoryStream.GetBuffer(), 0, memoryStream.GetBuffer().Length); 
  </code></pre>
  
  <p>The memoryStream length is 0. I need to download the saved pdf into Cleint machine.
  Please help me to fix this issue..</p>