This below is my code:-
Map parameters = new HashMap();
parameters.put(\"printer\", \"1010111\");
FileInputStream file = new FileInputStream(new File(getServletC
What is important to understand is that it is not the browser that is printing with
JasperPrintManager.printReport(print, false)
Its actually the server that is printing to your preferred printer, hence a web user will always print on the server printer (not on his own printer).
That's why
JasperPrintManager.printReport(print, true)
does not work, you can't tell the server to open the PrintDialog
. This call is used in desktop application.
It's impossibile to print directly on client printer (excluding the development of browser plugin that needs to be installed on client's browser). If this was possibile with out special plugin's our printers would be printing spam all day.
The closes you can get is to export the report to the browser and then automatically open the print dialog.
This is an example exporting to pdf: Automatically open the printer dialog after providing PDF download