码迷,mamicode.com
首页 > 编程语言 > 详细

Java生成条码二维码

时间:2018-03-16 17:24:55      阅读:391      评论:0      收藏:0      [点我收藏+]

标签:cap   bar   customer   -128   googl   bit   style   http   base   

一、概述

可用barcode4j或zxing等第三方库,推荐zxing。

barcode4j资料链接:http://barcode4j.sourceforge.net/

zxing资料链接:https://github.com/zxing/zxing

二、barcode4j

关键代码:

DataMatrixBean bean = new DataMatrixBean();
final int dpi = 800;
String format = "image/png";
ByteArrayOutputStream ous = new ByteArrayOutputStream();
BitmapCanvasProvider canvas = new BitmapCanvasProvider(ous, format, dpi,BufferedImage.TYPE_BYTE_BINARY, false, 0); 
bean.generateBarcode(canvas, info);
canvas.finish(); 

 支持的条码格式有:

  • Interleaved 2 of 5
  • ITF-14
  • Code 39
  • Code 128
  • EAN-128, GS1-128 (based on Code 128)
  • Codabar
  • UPC-A and UPC-E (with supplementals)
  • EAN-13 and EAN-8 (with supplementals)
  • POSTNET
  • Royal Mail Customer Barcode (Four State)
  • USPS Intelligent Mail (4-State Customer Barcode)

支持的二维码格式有:

  • PDF 417 (ISO/IEC 15438:2001(E))
  • DataMatrix (ISO/IEC 16022:2000(E))
  • QR Code (ISO/IEC 18004:2006(E)) (requires ZXing, available from CVS HEAD only)

可输出文件类型为:

  • SVG
  • EPS (Encapsulated PostScript)
  • Bitmap images (such as PNG or JPEG)
  • Java2D (AWT)
  • Text (for testing and debugging only)

Java生成条码二维码

标签:cap   bar   customer   -128   googl   bit   style   http   base   

原文地址:https://www.cnblogs.com/mahongbiao/p/8582786.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!