• 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.setContentType("application/pdf");
      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()];
      response.setContentLength(bytes.length);      
      bufferedInputStream.read(bytes,0,bytes.length);
      Pout.write(bytes);
      Pout.flush();
      Pout.close();
      bufferedInputStream.close();

it is urgent, pls provide the solution.

Thanks in advance.
Kamesh
0
Kamesh_Thatikonda
Asked:
Kamesh_Thatikonda
1 Solution
 
objectsCommented:
Are you sure it displays the entire file with 5.0?
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.

regards
Kamesh.
0
 
lhankinsCommented:
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");

0
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!

 
lhankinsCommented:
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.

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

-CE
0
 
KuldeepchaturvediCommented:
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..
0
 
CodingExpertsCommented:
Well you can go to menu edit->preferences->Internet and make sure Display PDF in browser is enabled.

-CE
0

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