我使用Java创建报告JasperReports。我想要做的是该用户能够直接打印,而无需打印对话框。
我创建了JasperPrint我知道打印机的名称和型号。如何将JasperPrint直接打印到打印机?
我也看过sample here,但无法弄清楚如何。
我使用Java 1.7和最新的JasperReports库。
有谁知道该怎么做?
public class PrintApp {
public static void print() {
JasperPrint jasperPrint = getJasperPrint();
String printername = AllPrinter.getDepartmentPrinter("Admin");
// where should i introduce my printer name to jasperreports?
JasperPrintManager.printReport(jasperPrint, false);
}
private static JasperPrint getJasperPrint() {
return JasperPrinterCreator.getJasperprint();
}
}
这看起来相关: https://community.oracle.com/thread/1758399 – selalerer