Skip to Content
0
Former Member
Jun 19, 2015 at 01:30 PM

Unable to Download PDF file in IE11

298 Views

Hi,

We need to download the data in PDF using OData Services. It is working fine in Chrome and Firefox but issues are encountered while doing the same for IE11. We have tried using the servlets but it is not recognizing the response.setHeader() itself. Below is the jquery used in controller.js for calling the servlet.

jQuery('<form action="http://<<hostname>>:<<port number>>/mgi.de~ml~download/PDFDownload" method="POST">'+input+'</form>').appendTo('body').submit().remove();

and the code used in the servlet:

byte[] byteData = outputStream.toByteArray();

response.setContentType("application/pdf");

response.setHeader("Content-Disposition", "attachment; filename="+fileName+".pdf"); //Not getting recognized//

response.setContentLength(byteData.length);

response.getOutputStream().write(byteData);

When we try to download, in the Save As popup it gives the name of the servlet for download without .pdf extension. On Save it gives the error - <<Filename>> could not be downloaded. It is happening because response.setHeader() is not recognized in IE11.

If anyone has worked on the similar requirement or any suggestions in this regard will be helpful.