This content has been marked as final.
Show 2 replies
-
1. Re: download a PDF rather than opening it
mikebgx Jan 17, 2011 5:26 PM (in response to mikebgx)Sorry, code didnt format well, should read:
byte[] pdf= rpt.toPdf(); // Produce PDF into our byte array // Now render PDF bytes to browser... HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); OutputStream os = response.getOutputStream(); response.setContentType("application/pdf"); response.setContentLength(pdf.length); response.setHeader("Content-disposition", "attachment; filename=\""+ rpt.getOutName()+ ".pdf\""); os.write(pdf); os.flush(); os.close(); facesContext.responseComplete();
-
2. Re: download a PDF rather than opening it
houda Mar 11, 2011 5:58 AM (in response to mikebgx)Hi , would please write all the code .