2006 IR Open Discussion Posted August 19, 2006 Share Posted August 19, 2006 By: Charles McClain - cmcclain1 "PDF output in new window" problem 2003-06-10 10:53 I am using a web application that includes a portal, and I am trying to link in JSPs, and Java helper classes to support the JSPs, that permit the user to request and then receive JasperReports report output on the screen. I have been successful, up to a point; using code modeled after pdf.jsp from the webapp sample, I can request a report and display either HTML or PDF report output on the screen. My users, however, want the report output displayed in an entirely new window. I can do it for HTML output, but not PDF output. I ve tried a couple different methods of doing it, and none have worked. First, the portal itself has an option to display content in a new window; second, I ve tried using a script in my JSP which contains a JavaScript window.open function. In all cases (again, my code is modelled after pdf.jsp ), when it hits the outputStream.write() method in my JSP, instead of displaying the PDF output, the browser instead pops up a dialog box that says I m trying to download a file, and asking whether I want to open it or download it. However, the open button is dimmed out, and the filename is actually the URL of my JSP. Please bear in mind that this same code works perfectly when I do not attempt to display the PDF report output in a new window. Believe me, if anyone can help, I will be VERY grateful. By: Chris Green - c_g12 RE: "PDF output in new window" problem 2003-06-10 10:59 Hi, try putting the following in your web.xml file: <mime-mapping> <extension>pdf</extension> <mime-type>application/pdf</mime-type> </mime-mapping> By: Charles McClain - cmcclain1 RE: "PDF output in new window" problem 2003-06-10 15:10 Chris: Your response makes sense; unfortunately, the application/portal I'm working with uses WebSphere, a very nonstandard WebServer which does not use a web.xml. I did, I think, find the appropriate place in the WebSphere administrative console to add the mime-type for PDF, but I still get the "download" dialog box. Still, I think you are on the right track. If I may, let me ask you another question: For certain "custom" mime-types, the application/portal identifies a Java class to act as the translator. Is it possible that I have to identify an iText class as the translator for the PDF mimi-type, and if so, do you have any idea which iText class should be used? In any event, thanks for the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now