0

This is my code to generate a PDF on the fly

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());

}

It works, but, I get this dialog:

enter image description here

instead of a 'Save as' dialog

what could be wrong?

auraham
  • 1,589
  • 2
  • 18
  • 27
  • check your Content Type. See this link http://stackoverflow.com/q/312230/425406 You most likely want "application/pdf". not even sure what x-download is – Sean Dec 05 '12 at 13:44
  • I tried that, but I get the same result. – auraham Dec 05 '12 at 19:13

0 Answers0