【问题标题】:cups4J printing multiple copiescups4J 打印多份
【发布时间】:2014-02-17 13:16:18
【问题描述】:

我有以下代码:

                FileInputStream fis =
                        new FileInputStream("C:/test.pdf");
                //PrintJob.Builder test = new PrintJob.Builder(fis);
                //test.duplex(true);
                //test.build();

                Map <String,String> newMap = new HashMap<String, String>();
                newMap.put("job-attributes", "sides:keyword:two-sided-short-edge#copies:2");
                  PrintJob pj = new PrintJob.Builder(fis).jobName("testJob").copies(2).attributes(newMap).build();

                cp.print(pj);

我遇到的问题是,即使我已将副本设置为 (2),它也只会打印一次......

我做错了什么?

【问题讨论】:

    标签: printing cups4j


    【解决方案1】:
    job-attributes 中的

    copies:2 不正确。你需要编码:

    copies:integer:2
    

    不知何故,不正确的工作属性条目导致...

    .copies(2)
    

    ..关于要忽略的 Builder。

    我能够在我的系统上使用 2016 年的旧 (!) de.spqr-info cups4j v1.1(不是当前的 v0.7.6 org.cups4j)在我的系统上重现。

    但请注意:如果 job-attributes 值正确,则将使用来自 Builder 的值(即使您没有指定它!在这种情况下默认为 1)

    使用作业属性值的唯一方法是在 Builder 上显式编码 .copies(n)(其中 n

    【讨论】:

      猜你喜欢
      • 2019-11-27
      • 2012-09-23
      • 2011-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-16
      • 1970-01-01
      相关资源
      最近更新 更多