在Angular 7中将ArrayBuffer转换为PDF

时间:2019-03-04 11:53:14

标签: angular typescript

如何使用Angular 7将数组缓冲区响应转换为PDF  这是我的代码

const body = new FormData();
body.append('clientApp', 'BUI');
body.append('projectName', this.ProjectName);
body.append('repoPath', this.RepoPath);
this.http.post(environment.GetPreview + this.SiteID + '&tango_ticket=' + this.TangoToken, body, { responseType: 'arraybuffer' } ).subscribe(res => {
  console.log(res);
});

我得到的回应

enter image description here

1 个答案:

答案 0 :(得分:0)

步骤1 npm安装文件保护程序--save 步骤2

this.http.post(environment.GetPreview + this.SiteID + '&tango_ticket=' + this.TangoToken, body, { responseType: 'arraybuffer' } ).subscribe(res => {
   saveAs(res, 'response.pdf');
});