title: How to view PDF Binary data in adobe reader using Jquery
body: <p>I am uploading and retrieving PDF attachment document in database in binary format uploading is done successfully when retrieving attachment I am getting response from the controller to jQuery but here I cannot display the binary data in PDF format</p>
  
  <p>My controller code: </p>
  
  <pre><code>public HttpResponseMessage Get()
  {
              pdfDbEntities db = new pdfDbEntities ();
              var data = from i in db.EmpTables
                         where i.Empno == 12
                         select i;
              EmpTable pdf = (EmpTable)data.SingleOrDefault();
              byte[] pdfData = pdf.Empattch;
              MemoryStream ms = new MemoryStream(pdfData);
              HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
              response.Content = new StreamContent(ms);
              response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
              response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application / pdf");
              return  response;  
  }
  </code></pre>
  
  <p>jQuery code:</p>
  
  <pre><code>$("#btnShow").click(function () {
                  var options = {};
                  options.url = "/api/Pdf";
                  options.type = "GET";
                  options.dataType = false;
                  options.contentType = false;
                  options.success = function (retData) {
                      $("body").append("&lt;iframe src='" + retData + "' style='' &gt;&lt;/iframe&gt;")
                      window.open(retData);
  
                  };
                  options.error = function (x,y,z) {
                      debugger
                      alert(err.statusText);
                  };
                  $.ajax(options);
              });
  </code></pre>