简体   繁体   中英

Load pdf to Blob and create url

I couldnt find answer anywhere so Iam posting the question. How to properly load byte array of pdf file (taken from ie Web API) to blob and then generate url based on this blob?

Tried to use this solution: AngularJS: Display blob (.pdf) in an angular app

But I keep getting: Failed to load PDF document.

Make sure you have set the responseType to arraybuffer ie {responseType:'arraybuffer'}

In case of Post:

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

In case of Get:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM