条码:用java实现128码的打印
来源:百度知道 编辑:UC知道 时间:2024/09/21 23:37:31
用JAVA实现条码的打印,及将我输入的数据如(420)10000生成相应的条码图片,然后输出到网页上就可以,现求好新人告知生成条码的原理或实现方法,谢谢
我在CSDN上下载了一个达人写的jar包,不知道是否有人认识相关的达人,有的话,麻烦告诉我一声,分可以再加,只要有用
我在CSDN上下载了一个达人写的jar包,不知道是否有人认识相关的达人,有的话,麻烦告诉我一声,分可以再加,只要有用
http://sourceforge.net/projects/barbecue/
我目前只能提供你这些。具体的例子你看他自带的文档
这个代码按照指定的字符串生成CSS代码,把他嵌入HTML后可以生成条形码
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class Code {
/*
* str:输入的字符串.
* ch:要显示条形码的高度.
* cw:要显示条形码的宽度.
* type_code:代码类型.
*/
public String bar_code(Object str, int ch, int cw, int type_code) {
String strTmp = str.toString();
String code = strTmp;
strTmp = strTmp.toLowerCase();
int height = ch;
int width = cw;
strTmp = strTmp.replace("0", "_|__||_||_");
strTmp = strTmp.replace("1", "|_|__|_|_|");
strTmp = strTmp.replace("2", "_||__|_|_|");
strTmp = strTmp.replace("3", "|_||__|_|_");