【问题标题】:Load pdf to Blob and create url将 pdf 加载到 Blob 并创建 url
【发布时间】:2015-03-15 13:34:34
【问题描述】:

我在任何地方都找不到答案,所以我发布了这个问题。如何将pdf文件的字节数组(取自即Web API)正确加载到blob,然后根据这个blob生成url?

尝试使用此解决方案:AngularJS: Display blob (.pdf) in an angular app

但我不断收到:无法加载 PDF 文档。

【问题讨论】:

  • 你能澄清你的问题并创建一个 plnkr 吗?

标签: javascript angularjs pdf asp.net-web-api blob


【解决方案1】:

确保您已将 responseType 设置为 arraybuffer,即{responseType:'arraybuffer'}

如果是邮寄:

$http.post('/postUrlHere',{myParams}, {responseType:'arraybuffer'})

在获取的情况下:

$http.get('/getUrlHere', {responseType:'arraybuffer'})

【讨论】:

    猜你喜欢
    • 2016-12-31
    • 2016-11-03
    • 2014-11-03
    • 1970-01-01
    • 2016-03-22
    • 2021-12-31
    • 1970-01-01
    • 2020-05-22
    • 2015-09-14
    相关资源
    最近更新 更多