• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem when sending a pdf file to the browser

 
Mohamedou Amri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using the code below to send a pdf file to the browser,
it works for some users (the browser does open the pdf file), but it does not work for the others. What should I do to make it working for every body?

Best Regards

response.setContentType ("application/pdf");
byte[] bytearray = new byte[(int) pdfFile.length()];
FileInputStream is = new FileInputStream (pdfFile);
is.read(bytearray);
ServletOutputStream os = response.getOutputStream();
os.write(bytearray);
os.flush();
is.close();
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65528
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define "it does not work".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!