title: PDF Display Angular 2
body: <p>I am having issue with Angular 2 Displaying a PDF In Iframe or any control.</p>
  
  <p>Can you guide me ?</p>
  
  <p>My Web API Code:</p>
  
  <pre><code> [Route("GetReportStream")]
      [HttpPost]
      public HttpResponseMessage GetReportStream(string strReportUrl)
      {
          strReportUrl = "http://sample.com/ReportServer?%2fN+Team+3%2fD+Online+Reports%2fMemo+to+the+Court&amp;rs:Command=Render&amp;rc:Parameters=False&amp;DocumentID=8&amp;rs:Format=PDF";
  
          byte[] pdf;
          byte[] buffer = new byte[4096];
          try
          {
              WebRequest request = WebRequest.Create(strReportUrl);
              request.UseDefaultCredentials = true;
              using (WebResponse resp = request.GetResponse())
              {
                  using (Stream responseStream = resp.GetResponseStream())
                  {
                      using (MemoryStream memoryStream = new MemoryStream())
                      {
                          int count = 0;
                          do
                          {
                              count = responseStream.Read(buffer, 0, buffer.Length);
                              memoryStream.Write(buffer, 0, count);
                          } while (count != 0);
                          pdf = memoryStream.GetBuffer();
                      }
                  }
              }
          }
          catch (Exception ex)
          {
              pdf = null;
          }
          var response = Request.CreateResponse&lt;byte[]&gt;(HttpStatusCode.OK, pdf);            
          return response;
      }
  </code></pre>
  
  <p>I am returning as  Byte which I am receiving it. </p>
  
  <pre><code>private getReportStreamOnSuccess(response): void {
      debugger;        
      var byteArray = new Uint8Array(response);
      var blob = new Blob([byteArray], { type: 'application/pdf' });
      //var file = new Blob([response], { type: 'application/pdf' });
      var fileURL = URL.createObjectURL(blob);
      this.url = this.domSanitizer.bypassSecurityTrustResourceUrl(fileURL);
  }  
  </code></pre>
  
  <p>I tried all option nothing is working.</p>
  
  <p>I Just want to view it in an iframe or any control.</p>
  
  <p>when i try to load blob i get this
  <a href="https://i.stack.imgur.com/PGIBI.png" rel="nofollow noreferrer">Image</a></p>