在IE中保存为pdf并不保存与filename相同的名称

时间:2017-09-27 13:58:28

标签: java google-chrome jsp internet-explorer activex

我有以下jsp文件:

byte[] file=null;
    String ctype ="application/pdf";
    RispostaPdf risposta = (RispostaPdf) session.getAttribute(Costanti.ATTRIBUTE_FILE_PDF);
    String docName = risposta.nomeFile;
    response.setContentType("" + ctype + "; name=\"" + docName + "\"");
    //response.setCharacterEncoding("ISO-8859-1");
    response.addHeader("Content-disposition", "inline; filename=\"" + docName + "\"");
    file = risposta.modulo;
    try {
        OutputStream outStrm = response.getOutputStream();
        outStrm.write(file);
        outStrm.flush();
        outStrm.close();
    } catch (Exception e) {
        out.println(e);
        e.printStackTrace();
    }

    //response.flushBuffer();
    session.removeAttribute(Costanti.ATTRIBUTE_FILE_PDF);

在新标签页中打开pdf文档。 当我从chrome保存pdf时,使用正确的名称(docName)保存:

filename=\"" + docName +

Chrome saved Chrome named file

在IE中,最后一个版本(11/10/9)保存为downloadServletName.pdf: IE saved IE named file

任何人都知道如何在IE中将保存的文件名更改为“filename = \”“+ docName”?

0 个答案:

没有答案