2

In my AngularJS application I have to request via HTTP POST for a pdf report. The response is an application/octet-stream, containing the pdf-file.(Response Header)

My angular call looks like this:

 $http.post($rootScope.HostPath + '/report',{ param1:value, param2:value }).
                then(function success(response) {
                    //magic should happen here :(
                },function error(response) {
                    console.log("Error Code : " + response.status );
                });
        }

How can I get the PDF out of this response javascript variable or is it possible to forward the response directly to the browser.

When I request with Postman or other tools, a download dialog pops up immediately. I've tried a lot of different solutions from stackoverflow but non of them are working in my case.

EGHM
  • 2,144
  • 23
  • 37
TheSecretus
  • 23
  • 1
  • 3

1 Answers1

1

have you check this posts :

AngularJS $http-post - convert binary to excel file and download

AngularJS: Display blob (.pdf) in an angular app

i think they could be solutions of your case.

Community
  • 1
  • 1
natnael88
  • 1,128
  • 10
  • 22