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

Posted on 2004-11-29
Last Modified: 2013-11-18
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");
    fileInputStream = null;    bufferedInputStream = null;      
      ServletContext objServContext = getServletContext();
                String strDirectoryName =  objServContext.getInitParameter("ClientStatementsPath").toString();
      fileInputStream = new + strFilePath);
      bufferedInputStream = new;      
      byte[] bytes = new byte[bufferedInputStream.available()];
      response.setContentLength(bytes.length);   ,0,bytes.length);

it is urgent, pls provide the solution.

Thanks in advance.
Question by:Kamesh_Thatikonda
    LVL 92

    Expert Comment

    Are you sure it displays the entire file with 5.0?

    Author Comment

    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.

    LVL 7

    Accepted Solution

    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");

    LVL 7

    Expert Comment

    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.

    LVL 6

    Expert Comment

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

    LVL 19

    Expert Comment

    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..
    LVL 6

    Expert Comment

    Well you can go to menu edit->preferences->Internet and make sure Display PDF in browser is enabled.


    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
    In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
    The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now