angular - Can't open PDF in Angular application
问题描述
I'm trying to open a PDF that I download via an API.
The API response looks like this:
This is my Angular print function:
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);
});
On the client side a new tab opens up with an error 'Failed to load PDF document"
解决方案
推荐阅读
- amazon-web-services - AWS Cloudformation 容器覆盖
- c# - 使用 .Net Core 开发跨平台“低级”软件
- ms-access - MsAccess QueryDef.SQL 与实际查询 sql 不同
- perl - 如何禁用 Perl Tk::Text 小部件的键盘绑定?
- ios - react-native - 在没有 Apple 开发者帐户的情况下部署到 iOS
- machine-learning - Softmax 层和最后一层神经网络
- google-apps-script - 如何制作一个谷歌表格脚本,从另一张表格返回单元格上的注释
- javascript - 流星笔预处理器在每个 text-laign:center 中添加 `j-`
- html - 圆形按钮在悬停时随文本展开
- nginx - 带有limit_req_zone的Nginx共享内存