准备ZPL命令以打印单色铬位图图像 [英] Prepare a ZPL command for printing the mono chrome bitmap image

查看:1273
本文介绍了准备ZPL命令以打印单色铬位图图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在准备用于在Zebra RZ400 300 dpi上打印位图图像的ZPL命令时遇到问题。

I have a problem in preparing the ZPL command for printing the bitmap image on Zebra RZ400 300 dpi.

我有以下代码片段,我不知道我在哪里极端地犯了错误。

I have folling code snippet and i dont understand where i am extacly making a mistake.

var bitmapImagePath = @"C:\Sample.bmp";

//Gets the size of the bitmap file
 long bitmapDataFileSize = new FileInfo(bitmapImageFilePath).Length;

byte[] bitmapData = System.IO.File.ReadAllBytes(bitmapImageFilePath);
string hexadecmimalString = BitConverter.toString(bitmapData).replace("-", string.empty);

 double widthInBytes = Math.Ceiling(bitmapDataWidth / 8.0);

string str = "";
            return str = "^XA^FO100,100^GFA," + //At Postion 100, 100
                bitmapDataSize.ToString() + "," +     // Total bytes of data to be placed
                bitmapDataSize.ToString() + "," +     // Total bytes of data to be placed, repeats as per API
                widthInBytes + "," + //
                hexadecmimalString + "^XZ";

你能告诉我哪里出了问题吗?
我可以用Multiplat表单SDK API打印,但我只对^ GFA或^ GFB命令感兴趣,这符合我的要求。

Can you please suggest me where its going wrong? I could able to print with Multiplat form SDK API, but i am intrested only in ^GFA or ^GFB command which suits my requrirement.

可以请任何建议我准备打印任何给定图像的^ GF命令。

Can any please suggest me to prepare the ^GF command that prints the any given image.

推荐答案

https://stackoverflow.com/questions/7083180/print-bmp-with-zpl?rq=1

这应该适合你。由于您是新会员,我强烈建议您使用搜索功能。

That should do the trick for you. As you're a new member I highly recommend you use the search feature.

此行:

var bitmapImagePath = :C:\\Sample.bmp";

应该是

var bitmapImagePath = @"C:\Sample.bmp";

您可能有两种选择。

如果您不需要使用ZPLII,可以使用Zebra驱动程序安装打印机。这样您就可以像使用常规桌面打印机一样使用Zebra打印机。然后您可以构建标签使用标准的.Net函数进行打印,并像编程一样将文档发送到打印机。

If you don't need to use ZPLII, you can install the printer using the Zebra drivers. This will allow you to use the Zebra printer as you would a regular desktop printer. You can then build your label using standard .Net functions for printing, and send the document to the printer as you would a regular document programmatically.

如果这不是一个选项,你将会我需要创建一个单色位图,我自己从未这样做过。但是你可以使用 img2grf 如果你这样做就转换不喜欢写你的转换器。您需要将该库转换为.Net程序集,这可以通过使用 IKVM轻松实现。 。有关如何使用IKVM的说明,请访问使用IKVM进行HtmlUnit转换并按照将HtmlUnit转换为.NET一节中的说明进行转换,这与转换img2grf的过程相同。

If this isn't an option, you'll need to create a monochrome bitmap, I've never done that myself. However you could use img2grf to convert if you don't feel like writing your converter. You'll need to convert that library into a .Net assembly, which can easily be achieved by using IKVM. For instructions on how to use IKVM simply visit HtmlUnit Conversion with IKVM and follow the instructions under the "Converting HtmlUnit to .NET" section, it's the same process to convert img2grf.

这篇关于准备ZPL命令以打印单色铬位图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆