无法在Angular应用程序中打开PDF

时间:2019-06-22 05:46:46

标签: angular

我正在尝试打开通过API下载的PDF。

API响应如下:

enter image description here

这是我的Angular打印功能:

print() {
  this.userService.print(this.route.parent.snapshot.paramMap.get('id'))
    .pipe(first())
    .subscribe(

      (result: any) => {
        var fileURL = URL.createObjectURL(new Blob([result], { type: "application/pdf" }));
        window.open(fileURL); 
      });

在客户端打开一个新标签,错误为“无法加载PDF文档”

0 个答案:

没有答案