문제

i have the following code:

                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);

The issues i have is even though i have set copies to (2) it only prints it out once....

anything i have done wrong?

올바른 솔루션이 없습니다

다른 팁

copies:2 in the job-attributes is incorrect. You need to code:

copies:integer:2

Somehow, the incorrect job-attributes entry causes the...

.copies(2)

..on the Builder to be ignored.

I was able to reproduce that on my system using the older(!) de.spqr-info cups4j v1.1 from 2016 (not the current v0.7.6 org.cups4j).

But beware: if the job-attributes value is correct, the value from the Builder will be used (even if you didn't specify it! It defaults in that case to 1)

The only way to use the value from the job-attributes is to explicitly code .copies(n) (where n <= 0) on the Builder.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top