ajax - How to build a file from binary string using javascript -


I am trying to use BusinessObject RESTful API to download a Generated (PDF or XLS) document.

I am using the following request:

  $ Ajax ({url: server + "/ biprws / raylight / v1 / document /" + documentId, type: "GET", contentType: "application / xml", data type: "text", header: {"X-SAP- LogonToken ": token," accept ":" application / pdf "}, success: work (mypdf) {// some content to execute}});  

I get this data as a response:

 % PDF-1.7% äãÏÒ 5 0 obj & lt; & Lt; / Length 6 0R / Filters / FlateDecode & gt; & Gt; // data // data // data %% EOF  

I previously assumed that it was a base 64 content, so to allow users to download the file, Added success row to rows:

  var uriContent = "data: application / pdf; base64," + encoderic monitor (mipidf); Var newWindow = window.open (uriContent, 'generated');  

But I have an ERR_INVALID_URL, or when I remove "Base 64" from Yuri content, then there is a failure when opening the generated file.

Do anyone have any ideas, can I use data feedback? I was but it was not Heliland. Thanks!

Bjorge

Nothing can be done with client-side javascript.

The server side coding will need to be changed so that a URL link can be generated (pointing to a PDF file) and sent as part of the response. User can download PDF from URL link


Comments