I have a print button in jsp page that prints a report created in jasper. What does calling JasperPrintManager.printReport(jasperPrint,true) in a jsp page actually do? I imagine it has to invoke a javascript command to bring up the print dialog and sends the data to it. It is not working for me. any idea?
+1
A:
No javascript whatsoever. JSP pages are compiled to regular HttpServlet
s, so perhaps it is executed on doGet(..)
i.e. on loading of the page. This however prints the document on the server.
If you want to print on the client, then you will need an Applet. Or, better, export in PDF and send the PDF to the user for printing.
Bozho
2009-11-18 16:09:34
I think that is incorrect, calling in jsp JasperPRintManager.printReport does bring up the print dialog, so some javascript has to be involved.
2009-11-19 22:39:17
No. The print dialog is shown because you test on localhost, and in fact this is the dialog opened on the server.
Bozho
2009-11-20 07:15:56
A:
Export your JasperPrint file to a PDF file. Set the content type on the response to "application/pdf". Finally redirect the response with the streamed PDF.
You can do it in one JSP, but thats not the best solution, better to create your own ReportServlet
medopal
2009-11-23 17:04:57