question

kyle avatar image
kyle asked kyle commented

How can I get the Printer width in px?

Hi, I am trying to print by using ImagePrintJob.Builder(), and for the best quality possible, I am trying to scale the image in pixel according to printer width.

according to: https://docs.clover.com/build/clover-...

There are 2 kind of width-- 384px and 576px Wondering how can I tell which is which programmatically?

Thanks

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered kyle commented

If you need to know that, you need to pass the specific printer to which you will print into the print() method. Otherwise nobody knows until the printer job gets to the service and it determines which printers are configured and possibly queries the user as to which printer they want to print. You can use PrinterConnector to get the set of configured printers.

That being said, the system should scale the image, so I think it's safe to just scale it to 576px and let the system scale it down further if necessary. I guess technically you don't need to scale it at all but it behooves you to keep the data being passing around as small as possible.

Here are the printer widths for all printer types we support:

STAR_TSP100_ETHERNET: 576px
STAR_TSP100_USB: 576px
STAR_TSP700_ETHERNET: 576px
SEIKO_USB: 576px
FIGLEAF_BT: 384px
SEIKO_MINI_USB: 384px
SEIKO_REMOTE: 576px
BAYLEAF_USB: 384px
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kyle avatar image kyle commented ·

Thanks a lot of the quick reply.

I am trying to have the text looks the same across devices. So I think I can't really count on the printer to scale.

I got the Printer through PrinterConnector, and a Printer knows the following.... public final String uuid; public final Type type; public final String name; public final String ip; public final String mac;

I think, I can set the pixel through the "name" variable, which I see the code name "Mini" for the Clover Mini build in printer.

Wondering what are the other code names for other printer?

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Yeah there's no getWidth() although that would have been good to add. You'll just have to, given the printer type and the documentation you referenced, keep your own mapping to the width. I'll update the answer to have the widths.

0 Likes 0 ·

Welcome to the
Clover Developer Community