0

On WebSphere portal I am trying to use JasperReport print functionality.

 JasperPrintManager.printReport(jasperPrint, true);

This way works fine for WAS and localhost. But when I deploy the application on Remote server, the dialog of print is not appearing and no printing work is done. Although I have used JavaPrint service to lookup all the printers and then select one for printing the task but it is not even working that way.

Ashish Aggarwal
  • 3,018
  • 2
  • 23
  • 46
Mujahid Masood
  • 111
  • 2
  • 8
  • There are a lot of similar questions on *SO*. You should use search engine on *SO* – Alex K Dec 30 '13 at 10:13
  • I have almost tried all, not one works. – Mujahid Masood Dec 30 '13 at 11:11
  • 2
    possible duplicate of [Print JasperReports client-side?](http://stackoverflow.com/questions/4694737/print-jasperreports-client-side) & [How to generate/print reports on the client side](http://stackoverflow.com/q/4691441/876298) & [JasperReports: Print a report directly at client side printer](http://stackoverflow.com/q/20015401/876298) & [JasperPrintManager.printReport(jasperPrint,true)](http://stackoverflow.com/q/1752706/876298) & [Printing JasperReport From Applet](http://stackoverflow.com/q/5116474/876298) – Alex K Dec 30 '13 at 17:15

1 Answers1

0

Your solution works on localhost because your client and server are the same machine. Thus calling a print command on the server side will make it look like it's printing from the client.

But you don't want it to print on server. You want the client's browser to have access to the report in a printable format. A common format is PDF.

As @AlexK mentions in the comments, there are already multiple other questions (with answers) on how to do this.

My suggestion for getting this done in a portlet is to have a button in your portlet view that will make a call to a serveResourceURL and download a PDF version of the report. The serveResource method was designed for situations like this where developers need to serve content other than HTML.

Nick Roth
  • 3,057
  • 2
  • 15
  • 15