title: Angular 6 open pdf from byte array sent from WebAPI
body: <p>Hi I have issues opening pdf from byte array sent by WebAPI.</p>
  
  <p>My Service:</p>
  
  <pre><code>getPdfDocument(): Observable&lt;any&gt; {
          return this.httpClient
              .get(this.configuration.serverUrl + this.configuration.getPdfDoc, {
                  responseType: "arraybuffer" //tried with 'blob'
              });
  }
  </code></pre>
  
  <p>My component:</p>
  
  <blockquote>
  <pre><code>this.service.getPdfDocument()
          .subscribe(data =&gt; {
              var file = new Blob([data], { type: 'application/pdf' });   
              this.pdfContent = URL.createObjectURL(file);
              window.open(this.pdfContent);
          })
  </code></pre>
  </blockquote>
  
  <p>When I run it I get failed to load PDF document... I enabled pop ups still no joy...</p>
  
  <p><a href="https://i.stack.imgur.com/Nfyzs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nfyzs.jpg" alt="enter image description here"></a></p>