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(); } } }
最近下载更多
huangbo28 LV1
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日
1211413075 LV14
2023年1月31日
pangxixin LV6
2023年1月31日
最近浏览更多
huangbo28 LV1
3月14日
蔡雨生
3月6日
暂无贡献等级
1112WHQ LV7
2023年11月3日
768325867 LV1
2023年10月25日
zhujianfei123 LV1
2023年7月22日
qingye LV1
2023年6月16日
crosa_Don LV18
2023年5月22日
zxsyaa LV1
2023年5月10日
daniellyer LV1
2023年4月18日
1358865648
2023年4月14日
暂无贡献等级