0

I couldnt find answer anywhere so Iam posting the question. How to properly load byte array of pdf file (taken from i.e. 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.

Community
  • 1
  • 1
Qba
  • 148
  • 1
  • 7
  • 25

1 Answers1

1

Make sure you have set the responseType to arraybuffer i.e. {responseType:'arraybuffer'}

In case of Post:

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

In case of Get:

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

Mahesh Pulle
  • 173
  • 1
  • 2
  • 9