[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Open PDF with JSP/Servlet in Internet Explorer

Asked by softwarea in Java Programming Language, J2EE, Java Servlets

Tags: pdf, open, ie

Hi,

please look at the following jsp, which should download and display a PDF in my current browser window:

<myDownload.jsp>
-------------------------------------------------------
<%@page import="java.io.*" %>
<%
  BufferedReader reader = null;
  String line;
  File file = new File("G://test.pdf");
 
  try {
        response.setContentType("application/pdf");
      response.setContentLength((int) file.length());
      response.setHeader("Content-Disposition","inline; filename=test.pdf");
      
      reader = new BufferedReader(new FileReader(file));
        while ((line = reader.readLine()) != null) {
          out.print(line);
        }
  }
  catch(FileNotFoundException fileNotFound) {
    out.print("The file does not exist.");
  }
  catch(IOException ioErr) {
    out.print("An error occured during output.");
  }
  finally {
        if (reader != null) {
          reader.close();
        }
  }
%>

When I call the jsp the result is not the expected:
1. The Acrobat Reader Plugin does not open in my browser (as it usually does when I click on a normal link to a PDF document).
2. Instead I get a single line of output in my browser: %PDF-1.3%âãÏÓ104 0 obj<< /Linearized 1 /O 106 /H [ 908 456 ] /L 237922 /E 105292 /N 8 /T 235723 >> endobj

Can anybody please help me on this? I searched with google and recognized that I'm not the only one who encounters this problem. Unfortunatley there does not seem to be a working solution till now...

Ah, I'm using IE 6 and Acrobat 5 (and I must use these versions!).

Thanks very much!
Ingmar

By the way, this is my goal:
I must store PDFs in a directory outside the virtual directories of my web server so they are not visible from the Internet/Intrant when the user types a URL. That's why I must not use some kind of a program controlled download.
[+][-]06/22/05 09:01 AM, ID: 14276562Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Java Programming Language, J2EE, Java Servlets
Tags: pdf, open, ie
Sign Up Now!
Solution Provided By: jim_cakalic
Participating Experts: 1
Solution Grade: A
 
[+][-]06/23/05 01:10 PM, ID: 14288002Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/24/05 01:00 AM, ID: 14291700Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/05 01:23 AM, ID: 14299102Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/05 03:17 PM, ID: 14301929Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/27/05 05:31 AM, ID: 14307841Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/28/05 05:25 PM, ID: 14324391Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/06/05 12:53 AM, ID: 14375523Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93