package com.util.jbarcode;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.imageio.ImageIO;
import net.sourceforge.jbarcodebean.JBarcodeBean;
import net.sourceforge.jbarcodebean.model.Ean13;
class JBB {
public static void main(String[] args) {
JBarcodeBean jBarcodeBean = new JBarcodeBean();
// 条形码类型
jBarcodeBean.setCodeType(new Ean13());
// jBarcodeBean.setCodeType(new Code39());
// jBarcodeBean.setBarcodeHeight(200);
// 在条形码下面显示文字
jBarcodeBean.setLabelPosition(JBarcodeBean.LABEL_BOTTOM);
OutputStream out;
try {
out = new FileOutputStream("F:\\a.gif");
jBarcodeBean.setCode("6922507005033");
BufferedImage image = new BufferedImage(200, 200,
BufferedImage.TYPE_INT_RGB);
image = jBarcodeBean.draw(image);
ImageIO.write(image, "JPEG", out);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// 设置条形码的值
catch (IOException e) {
e.printStackTrace();
}
}
}
最近下载更多
LIU_NQ LV1
2024年11月18日
limengqiang LV1
2024年5月21日
huangbo28 LV1
2024年3月14日
1112WHQ LV7
2023年11月3日
768325867 LV1
2023年10月25日
zhujianfei123 LV1
2023年7月22日
qingye LV1
2023年6月16日
daniellyer LV1
2023年4月18日
liminshabi LV2
2023年4月14日
guaixia163 LV13
2023年2月26日

最近浏览
