I have a MVC controller that will send back the base64 pdf string to the client via an ajax call.
The following line will display the pdf in a separate window for Chrome and FF.
<a href=data:application/pdf;base64," + data.PDFResult + " download title='Download pdf document' />
This will not work in IE and from what I read it doesn't appear to be supported.
So. Instead of displaying the PDF in a new window how can I make the user download the PDF instead?
UPDATE:
- Trying to send byte[] back to client via AJAX...
I changed JS to:
var pdfWin = window.open("data:application/octet-stream, " + escape(data), '', 'height=650,width=840');
and my controller to:
[HttpPost]
public byte[] GetPDFc(MyObject myData)
{
var pdfBytes = MethodToGetPDF(myData);
return (pdfBytes);
}