FileStream Response Shows � Instead Latin Characters
kindly read the whole question,I have a application in C# ASP.NET MVC. Which does a Ajax call on a function which returns a PDF file using FileStream with response STREAM A. And du
Solution 1:
Well, just need to set responseType to arraybuffer
for the ajax request. Since, the jQuery does not supports that dataType, have to use traditional Javascript Ajax
For more Info see Sending and Receiving Binary Data
function ajaxFileStream() {
var url = "/Home/GetFileStream";
var oReq = new XMLHttpRequest();
oReq.open("GET", url, true);
oReq.responseType = "arraybuffer";
oReq.onload = function (oEvent) {
console.log(oReq.response);
var blob = new Blob([oReq.response], { type: "application/pdf" });
var win = window.open('', '_blank');
var URL = window.URL || window.webkitURL;
var dataUrl = URL.createObjectURL(blob);
win.location = dataUrl;
};
oReq.send();
}
Thanks, bUKaneer that linked helped a lot.
Post a Comment for "FileStream Response Shows � Instead Latin Characters"