You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何按比例缩小ZPL条码尺寸?附现有ZPL代码求助

Got it, let's tackle this barcode scaling issue in ZPL. Your original code relies on the ^BY command to define the barcode's core dimensions—this is exactly where we’ll make changes to shrink it to match your target size.

Breakdown of Your Original ^BY Command

First, let’s unpack what ^BY2,2,20 does:

  • The first value (2) = module width: the width of the narrowest bar/spacer (measured in printer dots). This controls how wide the entire barcode is.
  • The second value (2) = aspect ratio: the height of the barcode relative to the module width. Keeping this consistent ensures the barcode retains its original shape when scaled.
  • The third value (20) = barcode height: total height of the barcode (in dots).

How to Shrink the Barcode

To replicate the "original → scaled down" effect you want, we’ll proportionally reduce the module width and barcode height while keeping the aspect ratio the same.

Example: 50% Scale (Half the Original Size)

Here’s the modified code:

^XA 
^FO50,20 
^BY1,2,10 
^BCN,,N,N,N,D 
^FDZWW011601512345^FS 
^XZ
  • Changed ^BY from 2,2,20 to 1,2,10:
    • Module width cut in half (from 2 to 1 dots) → makes the barcode narrower
    • Barcode height cut in half (from 20 to 10 dots) → maintains the original aspect ratio
  • The ^FO50,20 coordinates stay the same, but you can tweak these if the scaled barcode needs repositioning on your label.

For More Precise Scaling

If you need a specific scale (e.g., 70% of original), adjust the values proportionally:

  • Module width: 2 * 0.7 = 1.4
  • Barcode height: 20 * 0.7 = 14
    Modified code:
^XA 
^FO50,20 
^BY1.4,2,14 
^BCN,,N,N,N,D 
^FDZWW011601512345^FS 
^XZ

Note: Most modern ZPL printers support decimal module widths (0.1 to 10.0 in 0.1 increments) for fine-tuning.

内容的提问来源于stack exchange,提问作者Disuan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:25:47