I got the following PDF stream from a server:
如何在 AngularJS 中读取这个流?我尝试使用以下代码在新窗口中将其作为 PDF 文件打开:
.success(function(data) {
window.open("data:application/pdf," + escape(data));
});
但我无法看到打开的窗口中的内容。
我通过更改控制器代码实现了这一点
$http.get('/retrievePDFFiles', {responseType: 'arraybuffer'})
.success(function (data) {
var file = new Blob([data], {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)