I got the following PDF stream from a server:
How can this stream be read in AngularJS? I tried
The problem with using config.responseType is that the $http service still runs the default responseTransformer and attempts to convert the response to JSON. Also, you are sending the default accept headers. Here is an (untested) alternative:
$http.get('/retrievePDFFiles', {
headers: { Accept: "application/pdf"},
transformResponse: function(data) {
return new Blob([data], {type: 'application/pdf'});
}}).success(function (data) {
var fileURL = URL.createObjectURL(data);
window.open(fileURL);
});