Java中的条形码图像

时间:2011-09-19 10:33:28

标签: java barcode

如何在Java中创建条形码图像?我需要能够输入数字并生成相应条形码图像的东西。请记住,我不想使用任何可用于此类任务的免费库。我只想用类文件来实现它。

4 个答案:

答案 0 :(得分:2)

是烧烤是个不错的选择。它的源代码可用。我个人尝试过根据我的需要使它可用。您可以看到代码理解它,然后为它编写自己的类。

试试以下网址:

Barbecue Source Code

答案 1 :(得分:1)

您可以尝试使用Barbecue框架。但是,这是开源项目。

答案 2 :(得分:1)

您的客户在使用Code 128 字体时遇到问题吗?我在网上发现了一些免费赠品,我使用字体比使用图像创建者更容易,而且它嵌入到PDF中,可以很好地用于基于Web的应用程序。

答案 3 :(得分:0)

您可以将条形码字符作为图像嵌入base64吗?

<img alt="104,{Start B}" title="104,{Start B}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AC3gAT0BDuLeG4IAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 51,A:{S},B:{S}" title=" 51,A:{S},B:{S}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ACLgAScBA3yI80wAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 65,A:{SOH},B:{a}" title=" 65,A:{SOH},B:{a}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGngAbUBSuiAnEkAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 77,A:{CR},B:{m}" title=" 77,A:{CR},B:{m}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AAigALMAqe/ygasAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 80,A:{DLE},B:{p}" title=" 80,A:{DLE},B:{p}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AFhgARMAuXYaS+YAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 76,A:{FF},B:{l}" title=" 76,A:{FF},B:{l}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADXgAU0BFkrGa3IAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 69,A:{ENQ},B:{e}" title=" 69,A:{ENQ},B:{e}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AE3gAX0BLqHeudAAAAAASUVORK5CYII=" width="10" height="30"><img alt=" 85,A:{NAK},B:{u}" title=" 85,A:{NAK},B:{u}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAABAQMAAAAy+cYDAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/AGGgAWUBAqmuuv8AAAAASUVORK5CYII=" width="10" height="30"><img alt="106,{Stop}" title="106,{Stop}" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAABAQMAAAA/57ZEAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAADklEQVQIHQEDAPz/ADigARMA2dpJzT8AAAAASUVORK5CYII=" width="10" height="30">

如果是这样,图像是自包含的,您只需要一个字符串数组。抱歉尴尬的格式。