Java – how to read PDF stream in angularjs

I get the following PDF stream from the server:

How do I read this stream in angularjs? I try to open it as a PDF file in a new window using the following code:

.success(function(data) {
   window.open("data:application/pdf," + escape(data));
 });

But I can't see the content in the open window

Solution

I did this by changing the 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);
    });
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>