从 Printer.getGraphicsUtil 发出 printImage 命令时,如何阻止 Zebra 打印机 RW 420 自动送入大量额外纸张?

发布于 2024-12-11 18:22:55 字数 541 浏览 0 评论 0原文

我在 android 项目中使用 zebra RW420,并且正在编码,我发现即使只是使用 ZSDK 开发人员演示测试打印机,当发出打印命令时,打印机也会打印大量额外的纸张。在本例中,我正在测试签名捕获和打印演示。我确实发现,如果我将其连接到计算机并打印使用 Zebra Designer 创建的标签,它会正确打印标签,而无需额外的纸张(事实上,在这种情况下,我不介意多打印几毫米)。

如果有人知道如何拯救这里的一些树木,那就太好了!

有问题的代码是:

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();

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();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼前雾蒙蒙 2024-12-18 18:22:55

这对我来说非常适合:

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();

这不会浪费纸张,并且会打印到可用的文本/数据

假设您必须打印宽度 800 和高度 1200 的收据,但它正在打印高度约为 1200 的收据。 1800 。因此,浪费了 600 px 空白的收据,以利用您可以使用上面的代码的浪费。

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.

半衬遮猫 2024-12-18 18:22:55

您的 CPCL 标签中是否有关键字“FORM”?通常在 PRINT 之前

这告诉打印机在打印到打印机配置的页顶设置后换页。要禁用它,如果不需要,可以从格式中删除 FORM 关键字,或者可以将 top-of-form 设置为 0。

! U1 getvar "media.tof"

将显示您的表单顶部当前设置的内容

! U1 setvar "media.tof" "0"

会将其设置为 0,以便 FORM 将提供 0 个点

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文