title: Download a generated pdf from client
body: <p>I'm new in stackoverflow thus this is my first post. Please excuse my poor English... I have spent hours on related topics but no anwser met my needs.
  I'm working on an Address book and I want my users to be able to download a pdf contacts list whenever they want. Everything seems to go well but in fact the client never download the pdf file, though I can see it in the request using the chrome developer tool.
  Here is my code:</p>
  
  <pre><code>public void doPost( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {
  
      try {
          Document document = new Document();
          PdfWriter.getInstance( document, response.getOutputStream() );
          document.open();
          document.add( new Paragraph( "You've selected " + request.getParameter("number") + " contacts." ) );
  
          response.setContentType("application/pdf");
          response.setHeader( "Content-Disposition", "attachment; filename=\"contacts.pdf\"" );
  
          document.close();
      }
      catch( DocumentException e ) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>When examining the response, I get something like this:</p>
  
  <pre>
  %PDF-1.4
  %����
  2 0 obj
  >stream
  x�+�r
  �26S�00S
  5 0 obj
  >
  endobj
  6 0 obj
  >
  endobj
  xref
  0 7
  0000000000 65535 f 
  0000000320 00000 n 
  0000000015 00000 n 
  0000000408 00000 n 
  0000000163 00000 n 
  0000000459 00000 n 
  0000000504 00000 n 
  trailer
  ]/Info 6 0 R/Size 7>>
  %iText-5.4.1
  startxref
  645
  %%EOF
  </pre>
  
  <p>Does anyone have the kindness to tell me what's wrong ?</p>