3

We have Flex on the front end and Java on the back end. When a user will request for a PDF file, request will go to the Java backend, where a PDF file will be generated using Jasper Reports. What we dont know is how to display this PDF file in browser; since we dont want to use JSP/Servlets etc - It has to be flex only. Any suggestions?

Akshay
  • 11,803
  • 5
  • 29
  • 26

3 Answers3

1

i think this question is old, but it may help others, there's a new library developed by Jasper Forge them selves, which deals with JasperReports directly, i mean it's not a PDF viewer, but a JasperReport exporting tool, you can download it from here

i tried it through using JasperServer, when viewing reports you can choose from different options to export it, one of them is flash, and it's working nice

Amr Faisal
  • 2,004
  • 6
  • 27
  • 36
1

Flash Player cannot natively render PDF files. This is possible using Adobe AIR but not in a Flex application. Your best bet is to call navigateToURL() and open a Servlet in a new browser tab/window. The Servlet can simply write contents of the PDF file to the OutputStream and set the appropriate HTTP headers.

cliff.meyers
  • 17,666
  • 5
  • 51
  • 66
0

Well for starters, PDFs don't always display in the browser. It depends on the user's settings. You essentially header them the pdf file and either they download it or a program like Acrobat Reader opens in the browser to display it.

Not sure how this is done in flex, I would imagine if you're using Java one simple servlet could do it.

tkotitan
  • 3,003
  • 2
  • 33
  • 37
  • Yes, you are right. I meant that only, may be it was not clear. With Servlets it's simple, but we want to avoid that for reasons unknown to me :) – Akshay Mar 03 '09 at 14:34