• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1751
  • Last Modified:

unable to open PDF file in IE using java if I use Acrobat Reader 6.0

Hi, on clicking a hyperlink I need to read a pdf file from a server and I need show that document in a window, for that I have written the following code in a JSP page, it is working fine with Acrobat Reader 5.0, but it is showing empty screen if I use Acrobat Reader 6.0, I am providing my code below.

               javax.servlet.ServletOutputStream Pout = response.getOutputStream();
      response.setHeader("Content-disposition", "inline; filename=" + "ClientStatement.pdf");
      java.io.FileInputStream fileInputStream = null;      
      java.io.BufferedInputStream bufferedInputStream = null;      
      ServletContext objServContext = getServletContext();
                String strDirectoryName =  objServContext.getInitParameter("ClientStatementsPath").toString();
      fileInputStream = new java.io.FileInputStream(strDirectoryName + strFilePath);
      bufferedInputStream = new java.io.BufferedInputStream(fileInputStream);      
      byte[] bytes = new byte[bufferedInputStream.available()];

it is urgent, pls provide the solution.

Thanks in advance.
1 Solution
Are you sure it displays the entire file with 5.0?
Kamesh_ThatikondaAuthor Commented:
ya, I'm sure, and I hosted this application on my machine, and I'm using Apache tomcat web server, then I tested it from two client machines, one is having Acrobat Reader 5.0, and another one with Acrobat Reader 6.0; it is opening with 5.0, but not with 6.0, I am not able to understand why it is behaving like this.

so I guess you want to display the PDF In the acrobat plugin without popuping up the "open or save as dialog"...?   If this is the case, remove the following and it should work :

     response.setHeader("Content-disposition", "inline; filename=" + "ClientStatement.pdf");

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

for what its worth, I'm doing something similar in one of my applications, if I have this line, I get a dialog when downloading the PDF (prompting the user to open or save the file) :

     response.setHeader("Content-disposition", "inline; filename=" + "ClientStatement.pdf");

If I leave this off, it just transparently opens the PDF in the Acrobat PDF Plugin inside of the current IE window.

Try to reinstall Acrobat Reader 6.0, I guess it should solve the problem..

I remember that I have faced this problem... There are some settings in 6.0 that you have to do.. unfortunately I can not recall them.. but they were on edit-->preference-->Options tab and has to do something with plug ins...
I will try to find those settings and will let you know if I find them..
Well you can go to menu edit->preferences->Internet and make sure Display PDF in browser is enabled.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now