title: Javascript: Open PDF in new tab from byte array
body: <p>I'm using AngularJS with an HTTP resource to call an external API and my response is a byte array. I need to turn this byte array into a PDF in a new window. I haven't seen any very good solutions on here that work cross browser or that are pure javascript. Is there a way to do this?</p>
  
  <p>Here is my code:</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>Document.preview({id: $scope.order.id}, function(data){
  
      // Open PDF Here
      var file = new Blob([data], {type: 'application/pdf'});
      var fileURL = URL.createObjectURL(file);
      window.open(fileURL);
  
  });
  </code></pre>