I am using Cups4j in a java app, under Linux, with a thermal printer, I need to define the size of the media, so I can use 80mm or 50mm paper rolls on the printer.

There is an "attribute" method, but I don't know (there is not really much info) how to define the size of the media to print.

有帮助吗?

解决方案

Since this question is 10 months old, I'm guessing you either found an answer somewhere else or gave up.

Anyway, from what I understand you would have to do something like this:

    PrintJob job = new PrintJob.Builder(in).jobName("PrintLabel").userName ("anonymous").copies(1).build();
    HashMap<String, String> printJobAttributes = new HashMap<String, String>();
    printJobAttributes.put("job-attributes", "media:keyword:????_80x50mm");
    job.setAttributes(printJobAttributes );

I'm actually trying to figure the same thing out right now. I'm stuck at what to use where the question marks are, and I'm not sure "media" is the right attribute to use. If you were able to find another more complete answer let us know! :)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top