Error when printing jasper report using JasperPrintManager.printReport(print, true);

后端 未结 1 1704
再見小時候
再見小時候 2021-01-22 10:25

This below is my code:-

Map parameters = new HashMap();
parameters.put(\"printer\", \"1010111\");
FileInputStream file = new FileInputStream(new File(getServletC         


        
相关标签:
1条回答
  • 2021-01-22 11:00

    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

    0 讨论(0)
提交回复
热议问题