简体   繁体   中英

How to print in jasper directly

I have to hook up a thermal printer to my java app. I want to know how to print without print manager. I have come so far

JasperDesign jspDesign = JRXmlLoader.load(reportSource);
JasperReport jspReport = JasperCompileManager.compileReport(jspDesign);
JasperPrint jspPrint = JasperFillManager.fillReport(jspReport, params, datasource);
JRExporter exporter = new JRPrintServiceExporter();

JasperPrintManager.printReport(jspPrint, true);

I want to cut the "JasperPrintManager" and print after click the button. Anybody knows how to do this?

Not really sure if i understand youre Problem correctly, but if you write

JasperPrintManager.printReport(jspPrint, false);

Jasper will send your report directly to the printer which is set as standard in the system. Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM