在servlet上使用iText正确的文件下载对话框

时间:2012-12-05 01:23:21

标签: java servlets

这是我动态生成PDF的代码

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition", "attachment; filename=report.pdf");

    Api apix = new Api(new ApiRequest(2));

    apix.reporter.makeReport(response.getOutputStream());

}

它有效,但是,我得到了这个对话框:

enter image description here

而不是“另存为”对话框

可能出错?

0 个答案:

没有答案