0

I have a function that retrieves PDF bytes from another Webservice. What I wanted to do is make the PDF bytes also available to others by creating an API call that returns HttpResponseMessage.

Now, my problem is I don't think that passing it through json is possible, because it converts the PDF bytes into a string?

Is there any other practical way of passing the PDF, or making the PDF visible to the requestors?

(Note: saving the PDF file in a specific folder and then returning the URL is prohibited in this specific situation)

John Willemse
  • 6,608
  • 7
  • 31
  • 45
  • Did you have any luck with this? I am searching for exactly the same solution. View my question on SO http://stackoverflow.com/questions/21950828/how-to-display-a-server-side-generated-pdf-stream-in-javascript-sent-via-httpmes – zszep Feb 22 '14 at 14:29
  • See my question and answer on SO: http://stackoverflow.com/questions/21950828/how-to-display-a-server-side-generated-pdf-stream-in-javascript-sent-via-httpmes – zszep Feb 23 '14 at 07:19

1 Answers1

0

I just solved it. There is a new paramater responseType: 'arrayBuffer' which addresses this problem. Sample: $http.post('/api/konto/setReport/pdf', $scope.konta, { responseType: 'arraybuffer' }) View my question and answer on SO: How to display a server side generated PDF stream in javascript sent via HttpMessageResponse Content

Community
  • 1
  • 1
zszep
  • 4,450
  • 4
  • 38
  • 58