How to stop a Zebra Printer RW 420 from automatically feeding lots of extra paper when issuing command printImage from printer.getGraphicsUtil?

荒凉一梦 提交于 2019-11-27 22:44:01

问题


I am using a zebra RW420 in an android project and I am coding and I find that even when simply testing the printer using the ZSDK Developer Demos the printer is printing lots of extra paper when it is issued a print command. In this case I am testing out the signature capture and print demo. I do find that if I connect it to the computer and print a label created using Zebra Designer it prints the label properly with no extra paper (in fact i wouldn't mind a couple of millimeters extra in that case).

If any one knows how to save some trees here that would be great!

The code in question is:

connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
GraphicsUtil g = printer.getGraphicsUtil();
Bitmap image = signatureArea.getBitmap();

g.printImage(image, 0, 0, image.getWidth(), image.getHeight(), false);

connection.close();

回答1:


Do you have the keyword "FORM" in your CPCL label? It's usually before PRINT

This tells the printer to form feed after printing to the top-of-form setting the printer is configured to. To disable it, you can remove the FORM keyword from your format if you don't need it, or you can set the top-of-form to 0.

! U1 getvar "media.tof"

will show you what your top-of-form is currently set to

! U1 setvar "media.tof" "0"

will set it to 0, so that the FORM will feed 0 dots




回答2:


this works perfect for me:

Connection connection = getZebraPrinterConn();
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
// this is very important which sets automatic heigth setting for label
connection.write("! U1 JOURNAL\r\n! U1 SETFF 50 2\r\n".getBytes());
printer.printImage(new ZebraImageAndroid(bitmap), 0, 0,800, 1200, false);
connection.close();

This wont waste paper and it will print upto the availability of text/data

Assume that you have to print a receipt of width 800 and height 1200 , but it is printing a receipt of height approx. 1800 . so there is a wastage of a receipt for 600 px of white space to make use of that wastage you can use above code.



来源:https://stackoverflow.com/questions/7878012/how-to-stop-a-zebra-printer-rw-420-from-automatically-feeding-lots-of-extra-pape

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!