question

David06n avatar image
David06n asked ·

Printing long images over remote-pay-cloud is very slow

Hello,

When print short images (380px x 380px for example), it is pretty quick, it takes about 3 seconds to complete from the point the API called.

When printing images than that, it take much longer. For example, printing 380px x 1600px images (4 times longer) takes almost 1 minute to complete printing. The actual times the printer does the printing/rolling the paper is short, few seconds, but the time between the API called and the time the paper start rolling is very long, 50+ seconds

What is the problem, and is there workaround or way to fix it?

We use this api to talk with Clover Mini (over Secure Network Pay Display): https://github.com/clover/remote-pay-cloud

Thanks!

-David
Printsemi-integrationssecure network pay display
3 comments
10 |2000 characters needed characters left characters exceeded

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

Hi @David06n,

Which Clover Connector print method are you using (are you passing in a printRequest, bitmap or imageURL)?

-- Justin

0 Likes 0 · ·
Thank you for following up, @justin.a.

I'm using print() method of Clover Connector, passing in a printRequest.

Here's code simplified, illustrating how the image gets created and the api called:

printMe(printImage: HTMLImageElement) {
let pr = new sdk.remotepay.PrintRequest();
let img: any = printImage;
pr.setImage([img]);
this.cloverConnector.print(pr); // <-- This call takes long time, on images 380px x 1600px
}

And here's how printImage created, on browser:

let canvas = document.createElement('canvas');
canvas.width = pageWidth;
canvas.height = actuallHeight;
//....do drawing on the canvas

let printImage = document.createElement('img');
printImage.src = canvas.toDataURL('image/jpeg', 0.2);
printImage.onload = function() {
printMe(printImage);
}
0 Likes 0 · ·

Hi David,

Can you provide the exact image you're trying to print? You can send it to semi-integrations@clover.com

Best,

Keith

0 Likes 0 · ·
David06n avatar image
David06n answered ·
Thanks @keithryanwong, for your response.

We print only text, but want to format the text in various ways and places to let readers easy to pick up most important pieces of data. Namely: different font size, font style (bold), and especially text alignment (left, right, justified), similar to how Clover prints its receipts/reports.

We can't do that with .printText() since it only accepts plain text, and it uses various with font so we can't align text properly using space characters

Share
10 |2000 characters needed characters left characters exceeded

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

keithryanwong avatar image
keithryanwong answered ·
Hi @David06n,

The reason it takes so long to print an image of such a size is due to the way the image is broken up and sent over the wire. There is not currently a way to get around it.

To give you a comparison, I printed out an image roughly 1/20th the size of the image you sent me. Looking at the logs, two messages were sent over the wire totaling a size of ~50,000 characters. When I printed out the image you sent me, it required 23 messages totaling a size of ~1,050,000 characters.

If you are just printing text, you may find it more beneficial to use the connector.printText() function.

Best,
Keith

2 comments Share
10 |2000 characters needed characters left characters exceeded

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

Thanks @keithryanwong.

I can break the image into multiple shorter ones and call print() for each of them, but Clover Mini currently automatically add a lot of empty space on the paper between those calls.

Is there a way to configure or make Clover mini stop adding those empty spaces?

I thought of this because I notice images 4 higher take about 10 times longer to print (why?). If there is way to eliminate the empty spaces, I can break the images into 4 so that it will only take 12 seconds instead of 50+ seconds.

0 Likes 0 · ·
Hi @David06n,

Sorry for the late response, I hit post, but it didn't...
There is not a way to undo the space, as that is there for you to rip out the paper.

Just curious, can you tell me the case where you need to print out an image that large and text wouldn't suffice? It may be helpful for our engineering team to think about.

Best,
Keith
0 Likes 0 · ·

Welcome to the
Clover Developer Community