Is there a convenient way to display/Download a PDF file that is returned from the controller, the Controller retrieves a complex model and i am therefore using an Ajax call in order to call the ActionResult , the result received from the ActionResult is returned in the following format :
"%PDF-1.3 1 0 obj [/PDF /Text /ImageB /ImageC /ImageI] endobj 6 0 obj ....EOF"
Is there a way to assign this to a button to download , it is preferable that no Controller changes are required due to deployment issues with a client
i have tried to use a blob , however opening that blob returns a completely blank PDF
$.ajax({
type: "POST",
url: "Reporting/RenderRemoteReport",
data: { reportSetup: reportSetup },
success: function(response, status, xhr) {
debugger;
var type = xhr.getResponseHeader('Content-Type');
var blob = new Blob([response], { type: type });
var URL = window.URL || window.webkitURL;
var downloadUrl = URL.createObjectURL(blob);
$("#DLButton").attr("href",downloadUrl);
}
});