shangmisunmi / SunmiPrinterXSample

This repository shows how to use Sunmi-PrinterX SDK...
15 stars 4 forks source link

Question about CanvasAPI and LineAPI #3

Open aleks-khomenko opened 8 months ago

aleks-khomenko commented 8 months ago

Hello guys. Thanks for the brilliant example with wide range of printing forms.

I would like to ask about usage Canvas and Line Api in combination. For example I added a few methods into fun printLabel3() in the sample-ktx/src/main/java/com/sunmi/samples/printerx/ui/vm/LabelViewModel.kt

image

I run the code and get unexpected results. Canvas content printing first over Line Api content. Does Canvas have priority over Line Api. Or to use them together is a wrong way? I am not experienced with Kotlin. I will be appreciated, for the answer.

I Printing result example: IMG_6131

git175010415 commented 6 months ago

Sry, I didn't reply in a timely manner. CanvasApi can indeed support thermal printing but it only effective on Sunmi Devices. When using LineApi, we do some checks when processing them(200ms delay), so it won't execute immediately. But CanvasApi doesn't matter, so it's called sequentially in a function, and CanvasApi is faster than LineApi.

Now I suggest using only one of them. And We will consider supporting your needs.

aleks-khomenko commented 6 months ago

Sry, I didn't reply in a timely manner. CanvasApi can indeed support thermal printing but it only effective on Sunmi Devices. When using LineApi, we do some checks when processing them(200ms delay), so it won't execute immediately. But CanvasApi doesn't matter, so it's called sequentially in a function, and CanvasApi is faster than LineApi.

Now I suggest using only one of them. And We will consider supporting your needs.

Thanks