ZPL 条码缺少前 2 位数字

ZPL Barcode missing front 2 digit

我正在尝试在具有以下 ZPL 代码的标签上垂直打印 EAN 条形码:

^FO895,273^BY3^BUB,200,Y,N
^FO895,261^FD9827755779090^FS

我期望输出为 9827755779090。但是,它打印为 277557790900.

它截去前2位数字(98)并在最后一位数字上添加(0)。我可以知道如何修复我的代码吗?

您为条形码提供的数据超过了规范设置的数据。

此外,您创建的不是 EAN 代码,而是 UPC(12)。

Specification :

UPC (technically refers to UPC-A) consists of 12 digits

Specification of ZPL II 关于 UPC-A(代码 ^BU)第 5.34 节特别指出:

^FD : exactly 11 characters. ZPL II auto-truncates or pads ON THE LEFT with 0 to achieve required number of characters.

(我加了斜体)

所以你得到

^FO895,261^FD9827755779090^FS
               -----------  << these 11 digits

正好27755779090的UPC校验和是0

这就是为什么 ^FO895,261^FD999999988889827755779090^FS

会得到相同的结果

要准确获得您想要的,请使用

^FO895,261^FD98277557790^FS

.. 这将得到 4

的校验和

^BE 是 EAN 命令。它将为您计算校验位。

^BE; EAN-13 Bar Code. Description: The ^BE command is similar to the UPC-A bar code. It is widely used throughout Europe and Japan in the retail marketplace. The EAN-13 bar code has 12 data characters, one more data character than the UPC-A code. An EAN-13 symbol contains the same number of bars as the UPC-A, but encodes a 13th digit into a parity pattern of the left-hand six digits. This 13th digit, in combination with the 12th digit, represents a country code. • ^BE supports fixed print ratios. • Field data (^FD) is limited to exactly 12 characters. ZPL II automatically truncates or pads on the left with zeros to achieve the required number of characters.

这是固定代码(更改了^FO)。

^XA
^FO95,273^BY3^BEB,200,Y,N
^FD9827755779090^FS
^XZ