Image truncated with PrintImage due to media length

Tags: 

I'm trying to print a receipt obtained from another system, so the easiest way that I've found is to convert it to an image and print it (the receipt is quite complex, so it cannot be rebuilt as "simple text").

I'm printing it using the PrintImage function, on a Xamarin.iOS app, but I think the same issue apply also to other technologies.
The printer is a ZQ320.

The image's height can be quite variable, due to the number of items that the receipt contains.
When the image is not too high, it is printed correctly.
When it's more than a certain height, instead, it is not printed completely, a part is "truncated".

From the Zebra Printer Setup app I can see that in the media settings the "current media type" is "receipt" and the length parameter was, by default, 1.51 in.
If I increase the length value, e.g. to 10 inch, then the whole image is printed.

Actually the work around to increase the length in the media settings can't be a final solution, because the length of the image is variable.

I've tried to "play" with the PrintImage overloads, but I didn't get any result.
I tried also to change the "media.feed_length" setting using the SetSetting function, but it didn't work as well.

The only solution that, at the moment, worked, was to "embed" the image in a ZPL file and then use the ^LL parameter to specify a certain height (and I have yet to understand to which value I should set the height, I didn't explore this option too deep yet).

The question is: is there a better method to print these images, without recurring to the ZPL workaround?

And another question is: I've seen that functions such as PrintImage and StoreImage, in the documentations, warn about some OutOfMemory exceptions that could be thrown with images e.g. bigger than 1024x768. In my case I cannot exclude to have images bigger than these limits. Should I use other ways to send the image to the printer?

Steven Si
Hi Stefano,

Hi Stefano,

When the media.type on the printer is set as journal (for receipt or variable length label), the zpl.label_length dictates length of the receipt. Since PDF of the receipt is converted to image, which is sent to the printer via PrintImage(), the zpl.label_length on the printer determines the length of the image to be printed. If you know the image length beforehand, for example, 800 dots (number of dots), then you can use Connection.Write() to send a dedicated ZPL below to configure the zpl.label_length on the printer prior to sending the image via PrintImage().

^XA
^LL800
^XZ

Alternatively to use SGD.SET() to issue the following SGD command to set the length prior to sending the image.

! U1 setvar "zpl.label_length" "800"

In this way, you don't need to *embed* the image into a ZPL.

Another way is to enable the PDF direct on the ZQ320 printer, so you don't need to convert the PDF to image. You simply send the PDF directly to the printer to print. Again, you still need to know the length beforehand and set the zpl.label_length on the printer prior to sending the PDF. There is an article about PDF Direct on Link-OS 6.3 - Printers Include Free PDF Direct with Link-OS 6.3.

Hope this helps.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Stefano Ottaviani
Thanks Steven, I solved my

Thanks Steven, I solved my issues starting from your suggestions :)

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments