0

Javaで印刷システムを実装しました。プリンターのステータスを取得する必要があるため、次のAttributeSetように使用しました。

PrintService service = PrintServiceLookup.lookupDefaultPrintService();
AttributeSet attributeSet = service.getAttributes();
for (Attribute a : attributeSet.toArray()) {
     System.out.println(a.getName() + ": " + attributeSet.get(a.getClass()).toString());
}

これにより、出力の下に返されます(プリンターがオフまたは一時停止している場合でも):

printer-name: EPSON LQ-350 ESC/P2
color-supported: not-supported
printer-is-accepting-jobs: accepting-jobs
queued-job-count: 0

ただし、プリンターの状態をより具体的にする必要があります。たとえば、プリンターがオフ一時停止か、または用紙が問題ないかどうかを知る必要があります。正確なプリンターのステータスを取得するにはどうすればよいですか?

4

0 に答える 0