AnsweredAssumed Answered

How to use dojo or esriRequest object to get pdf that is stream in a byte array

Question asked by brettlawson on Sep 19, 2017
Latest reply on Sep 20, 2017 by brettlawson

I have an SOE that creates a pdf and streams it back in the response and it works great.  Now how can I call it using dojo or the esriRequest object to call the SOE and display the resulting pdf in a new window?  I see the esriRequest has a handleAs that can be set to document, but I fail to see how it is implemented.  I have seen examples of using dojo.io.iframe, but I prefer not to use a deprecated library.

 

var downloadPdfIframeName = "downloadPdfIframe";
var iframe = dojo.io.iframe.create(downloadPdfIframeName);
dojo.io.iframe.setSrc(iframe, url, true);

 

I would be nice if I could just use straight javascript and do something like window.open(encodeURIComponent(url)), but the url would be too long after I add all the parameters to the querystring and it would have to be a post request.

 

Any help piecing it together would be appreciated.

 

Thanks

Outcomes