java - 打印时缺少报告
问题描述
我有一个应用程序,允许用户将文档列表直接发送到打印机。他们可以在屏幕上看到条目列表,当他们单击“打印”时,应用程序会一一创建它们并将它们发送到打印机。它工作得很好,但有时它会遗漏一两个。
我创建了日志以查看发生了什么,但它没有显示任何内容。以下是将文档发送到打印机的方法
public static void print(PDDocument document) throws PrinterException
{
PrintService printer= findPrinter();
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
job.setPrintService(printer);
try {
job.print();
logger.info("sent to printer: " + printer.getName());
}catch (Exception ex){
logger.info("fail to send to printer: " + printer.getName());
throw new PrinterException("Report fail to print");
}
}
今天的日志就是这些。该方法之外还有其他日志来识别打印的报告。上次打印的报告是因为之前的批次中缺少它。但是,它显示为已发送到批次中的打印机。
2020-03-05 11:44:02 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 11:44:02 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67969 and appId: 323412
2020-03-05 11:44:24 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 11:44:24 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67971 and appId: 323441
2020-03-05 11:44:50 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 11:44:50 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67972 and appId: 323688
2020-03-05 11:44:50 INFO EspFailureServiceManager:108 - This is info: 3 reports have been created
2020-03-05 12:37:47 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:37:47 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67973 and appId: 321932
2020-03-05 12:37:50 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:37:50 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67973 and appId: 321931
2020-03-05 12:37:54 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:37:54 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67973 and appId: 321930
2020-03-05 12:37:56 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:37:56 INFO EspFailureServiceManager:102 - This is info: Report created with batchId **67973** and appId: **321929**
2020-03-05 12:37:59 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:37:59 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67973 and appId: 321933
2020-03-05 12:38:02 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:38:02 INFO EspFailureServiceManager:102 - This is info: Report created with batchId 67973 and appId: 321924
2020-03-05 12:38:02 INFO EspFailureServiceManager:108 - This is info: 6 reports have been created
2020-03-05 12:39:58 INFO EspFailureServiceManager:74 - sent to printer: \\niabps01\ACC Mono Printer
2020-03-05 12:39:58 INFO EspFailureServiceManager:102 - This is info: Report created with batchId **67973** and appId: **321929**
2020-03-05 12:39:58 INFO EspFailureServiceManager:108 - This is info: 1 reports have been created
有人可以帮忙吗?
解决方案
推荐阅读
- lme4 - 如何使用 R 中的 lmer() 检查 REML(或混合模型)中的 p 值?
- r - 对 R 中的字符列表求和的 R 函数和代码是什么?
- javascript - 将暗模式信息存储在 cookie 或本地存储中以更快重新加载的替代方法
- node.js - TypeError [ERR_INVALID_ARG_TYPE]:第一个参数必须是字符串类型或 Buffer 或 Uint8Array 的实例。收到未定义
- scala - Spark scala - 数据帧比较
- android - 导航组件未为底部导航片段调用 onDestroy
- php - 在 curl Api 上获取多个获取数据的总数
- javascript - 在 html 页面中创建 M*N 表并使用 java 脚本导出和下载 excel 文件
- javascript - 按钮出现 ejs 问题
- python - 从行中删除 \n 但不在 '.' 之后