How to read pdf stream in angularjs

后端 未结 5 463
[愿得一人]
[愿得一人] 2020-12-01 06:32

I got the following PDF stream from a server: \"PDF

How can this stream be read in AngularJS? I tried

5条回答
  •  醉酒成梦
    2020-12-01 07:12

    I achieved this by changing my controller code

    $http.get('/retrievePDFFiles', {responseType: 'arraybuffer'})
           .success(function (data) {
               var file = new Blob([data], {type: 'application/pdf'});
               var fileURL = URL.createObjectURL(file);
               window.open(fileURL);
        });
    

提交回复
热议问题