【发布时间】:2018-10-19 08:53:44
【问题描述】:
您好,我在从 WebAPI 发送的字节数组打开 pdf 时遇到问题。
我的服务:
getPdfDocument(): Observable<any> {
return this.httpClient
.get(this.configuration.serverUrl + this.configuration.getPdfDoc, {
responseType: "arraybuffer" //tried with 'blob'
});
}
我的组件:
this.service.getPdfDocument() .subscribe(data => { var file = new Blob([data], { type: 'application/pdf' }); this.pdfContent = URL.createObjectURL(file); window.open(this.pdfContent); })
当我运行它时,我无法加载 PDF 文档...我启用了弹出窗口仍然没有乐趣...
【问题讨论】:
标签: angular typescript google-chrome pdf httpclient