2001 JI Open Discussion Posted August 15, 2006 Share Posted August 15, 2006 By: Darryl Baker - shakenbake How do you invoke acrobat reader from applet? 2002-07-30 20:17I have been able to fill a report. I use JasperRunManager.runReportToPdf to get byte array which I send to client from servlet via: res.setContentType("application/pdf"); res.setContentLength(bytes.length); ServletOutputStream oos = res.getOutputStream(); oos.write(bytes, 0, bytes.length); oos.flush() oos.close() When I fire up tomcat and load my applet into the browser nothing happens from the above code. In my applet I have the following code to pick up the byte array from the servlet. Nothing gets printed for the variable objRetd in java console. ObjectInputStream ois = new ObjectInputStream(uc.getInputStream()); objRetd = ois.readObject(); ois.close(); System.out.println(objRetd); Now I got the provided webapp sample to work. Therefore, my guess is that the browser will only invoke the acrobat reader plug-in if the jsp or servlet is called from the main browser window and not an applet window. My question is how can I invoke adobe from the applet if I send the report data to an input stream on the client? How are others viewing jasper reports this way? By: Eric Everman - eeverman RE: How do you invoke acrobat reader from app 2002-07-30 21:27Why would you want to do this? It sounds like a lot of extra complexity! One thing that jumps at at me is that you are trying to use an ObjectInputStream on the client side to catch the data, but the data you are receiving is not any type of Java Object - its just a raw binary stream. I would suggest: If you need to use an applet for some type of advanced UI for the user to design the report, do it. But when its time to view the report, direct the browser (from your applet) to a new URL using a POST command that includes all of the parameters you need on the server side to create the report. Remember that the URL you direct the browser to should have a .pdf extension if you want to avoid confussing IE. Good Luck, Eric Everman 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