1

我正在寻找一种从打印机获取打印作业数据的方法。

我只得到打印机队列计数和打印机名称..

我的代码。

if (myPrinter != null) {  
        PrintServiceAttributeSet att =myPrinter.getAttributes();
        for (Attribute a : att.toArray()) {
            String attributeName;
            String attributeValue;
            attributeName = a.getName();
            attributeValue = att.get(a.getClass()).toString();
            String gh = (attributeName + " : " + attributeValue);
            if (gh.equals("printer-is-accepting-jobs : not-accepting-jobs")) {
                 System.out.println("Printer Not Available");
            }
            if (gh.equals("queued-job-count : 0")) {
                System.out.println("queued-job-count");
            }
            System.out.println(gh);
        }

从打印机获取所有打印作业的任何可能性..

4

0 回答 0