目前我正在编写一个标签打印程序(Java中的Brother QL-570),用于打印具有不同ID的条形码。条形码数据的长度可以从约17个字符到约3个字符不等。
然而,如果我正确理解了条形码的概念,数据越多,条形码就会变得越宽。
我希望所有的条形码都具有相同的大小:无论数据长度如何。(如果条形码不能填满标签,它看起来不好看;如果太大,它也不能正常工作)
当标签具有固定的大小(即29mm x 90mm)时,该如何处理?您或您的公司是如何解决这个问题的?二维条码不是一个选择。很遗憾。
目前我正在编写一个标签打印程序(Java中的Brother QL-570),用于打印具有不同ID的条形码。条形码数据的长度可以从约17个字符到约3个字符不等。
然而,如果我正确理解了条形码的概念,数据越多,条形码就会变得越宽。
我希望所有的条形码都具有相同的大小:无论数据长度如何。(如果条形码不能填满标签,它看起来不好看;如果太大,它也不能正常工作)
当标签具有固定的大小(即29mm x 90mm)时,该如何处理?您或您的公司是如何解决这个问题的?二维条码不是一个选择。很遗憾。
我认为最好的做法是填充你的数据,即
123
变成
00000000000000123
从其他地方的做法来看,我在日常生活中确实见过填充零的条形码。我认为最好的做法是选择一个你认为足够多年使用的数字,并将应用程序编码为该数字。如果你最终需要超出这个数字,那么这是一个好问题,不是吗?
如果你需要将不同宽度的条形码并排比较,这看起来会有点奇怪,但是我们公司通过将每个符号定义为1x??位图并将其缩放到所需的应用程序大小来解决了这个问题。例如,除Stop之外,每个Code 128符号宽度为11个像素。然后,我们的“字体”有107个字符定义,每个字符是1x11的黑白位图(PNG)。
如果您能控制垂直和水平尺寸,那么在适合所提供空间的条形码中添加这些控制会更加简单。
下面是一个类似于上面图片的快速示例:
<img
alt="104,{Start B}" title="104,{Start B}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AC3gAT0BDuLeG4IAAAAASUVORK5CYII=" width="30" height="30"><img
alt=" 17,A:{1},B:{1}" title=" 17,A:{1},B:{1}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGMgAOkAhBjTObMAAAAASUVORK5CYII=" width="30" height="30"><img
alt=" 18,A:{2},B:{2}" title=" 18,A:{2},B:{2}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADGgAQUA0nI/mr0AAAAASUVORK5CYII=" width="30" height="30"><img
alt=" 19,A:{3},B:{3}" title=" 19,A:{3},B:{3}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADRgAMsAlQDS68kAAAAASUVORK5CYII=" width="30" height="30"><img
alt=" 08,A:{(},B:{(}" title=" 08,A:{(},B:{(}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AHNgAUkA1ElZCJAAAAAASUVORK5CYII=" width="30" height="30"><img
alt="106,{Stop}"title="106,{Stop}"src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAABAQMAAAA/57ZEAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADigARMA2dpJzT8AAAAASUVORK5CYII=" width="30" height="30">
<p/>
123
<br>
<p> </p>
<img
alt="104,{Start B}" title="104,{Start B}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AC3gAT0BDuLeG4IAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 17,A:{1},B:{1}" title=" 17,A:{1},B:{1}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGMgAOkAhBjTObMAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 18,A:{2},B:{2}" title=" 18,A:{2},B:{2}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADGgAQUA0nI/mr0AAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 19,A:{3},B:{3}" title=" 19,A:{3},B:{3}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADRgAMsAlQDS68kAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 20,A:{4},B:{4}" title=" 20,A:{4},B:{4}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADYgAI8AVxcQlAsAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 21,A:{5},B:{5}" title=" 21,A:{5},B:{5}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ACNgAKkAhD/i5lYAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 22,A:{6},B:{6}" title=" 22,A:{6},B:{6}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADFgAMUAksTlwtMAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 23,A:{7},B:{7}" title=" 23,A:{7},B:{7}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ABIgAEcAM15OsZIAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 24,A:{8},B:{8}" title=" 24,A:{8},B:{8}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ABZgAI8Ad3Mh6bwAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 25,A:{9},B:{9}" title=" 25,A:{9},B:{9}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ABpgAJcAex9glyQAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 16,A:{0},B:{0}" title=" 16,A:{0},B:{0}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGJgAScAw0BJukMAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 17,A:{1},B:{1}" title=" 17,A:{1},B:{1}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGMgAOkAhBjTObMAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 18,A:{2},B:{2}" title=" 18,A:{2},B:{2}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADGgAQUA0nI/mr0AAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 19,A:{3},B:{3}" title=" 19,A:{3},B:{3}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADRgAMsAlQDS68kAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 20,A:{4},B:{4}" title=" 20,A:{4},B:{4}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADYgAI8AVxcQlAsAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 21,A:{5},B:{5}" title=" 21,A:{5},B:{5}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ACNgAKkAhD/i5lYAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 22,A:{6},B:{6}" title=" 22,A:{6},B:{6}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADFgAMUAksTlwtMAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 23,A:{7},B:{7}" title=" 23,A:{7},B:{7}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ABIgAEcAM15OsZIAAAAASUVORK5CYII=" width="9" height="30"><img
alt=" 64,A:{NUL},B:{`}" title=" 64,A:{NUL},B:{`}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AF5gAR8Av0A69KoAAAAASUVORK5CYII=" width="9" height="30"><img
alt="106,{Stop}"title="106,{Stop}"src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAABAQMAAAA/57ZEAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADigARMA2dpJzT8AAAAASUVORK5CYII=" width="9" height="30">
<p/>
12345678901234567
123
和00000000000000123
有区别吗? - durron597