Barcode Image in Java
How can I create a barcode image in Java? I need something that will allow me to enter a number and produce the corresponding barcode image. Remember that I don'开发者_如何学运维t want to use any of the free libraries available for this type of task. I just want to achieve it with a class file.
Yes barbecue would be a good option. Its source code is available. I have personally tried it to make it usable as per my needs. You can see the code understand it and then write your own class for it.
Try out the following url:
Barbecue Source Code
You can try Barbecue framework. But, this is open source project.
Does your client have a problem with using a Code 128 font? I found a few freebies on the net, it was easier for me to work with a font than an image creator, plus it embedded into a PDF just fine for use on web based apps.
Can you embed the barcode characters as images in 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">
If so, the images are self contained and all you need is an array of strings. Sorry about the awkward formatting.
精彩评论