All Projects → Nepxion → Zxing

Nepxion / Zxing

Licence: Apache-2.0 license
🎫 Nepxion Zxing is a general code picture generator based on google zxing framework, support QR code and EAN code for file and byte array formats 基于Google Zxing的二维码/条形码创建和扫描组件

Programming Languages

java
68154 projects - #9 most used programming language
Batchfile
5799 projects

Projects that are alternatives of or similar to Zxing

ZxingSupport
A Library based on Zxing, make you easy to develop 1D/2D barcode-scan App.
Stars: ✭ 15 (-42.31%)
Mutual labels:  qrcode
qrcode-generator
Generate QR Code matrices and images in RAW, PNG and SVG formats.
Stars: ✭ 30 (+15.38%)
Mutual labels:  qrcode
checkdigit
🔒 An easy-to-use check digit library for data validation
Stars: ✭ 19 (-26.92%)
Mutual labels:  ean
Codeigniter3-absen-digital
Sistem Absensi Online dengan framework codeigniter 3
Stars: ✭ 33 (+26.92%)
Mutual labels:  qrcode
qrencode-el
QRCode encoder for Emacs in pure elisp
Stars: ✭ 18 (-30.77%)
Mutual labels:  qrcode
QRCode
纯前端JS :QRCode 扫描、生成二维码、从相册获取图片识别、生成带Logo二维码、能识别:微博、微信、QQ等 扫一扫 二维码,该项目功能共分为:Js版 和 Vue.js两个版本!
Stars: ✭ 72 (+176.92%)
Mutual labels:  qrcode
promptpay
Thai QR PromptPay Generator
Stars: ✭ 24 (-7.69%)
Mutual labels:  qrcode
otp-authenticator-webapp
A 'Google Authenticator' like Single Page Application
Stars: ✭ 69 (+165.38%)
Mutual labels:  qrcode
pyqrshare
Lets you transfer files and directories from your computer to your mobile device by scanning a QR code right from the terminal.
Stars: ✭ 12 (-53.85%)
Mutual labels:  qrcode
js-qrcode
The library is for generating QR codes like SVG, HTML5 Canvas, PNG and JPG files, or text.
Stars: ✭ 35 (+34.62%)
Mutual labels:  qrcode
qrcode-utils
二维码生成工具
Stars: ✭ 82 (+215.38%)
Mutual labels:  qrcode
SkiaSharp.QrCode
Qr Code Generator with Skia. (no System.Drawing)
Stars: ✭ 72 (+176.92%)
Mutual labels:  qrcode
qrcodescan.in
📠 A simple, fast, and useful progressive web application.
Stars: ✭ 144 (+453.85%)
Mutual labels:  qrcode
qikQR
minimal desktop app to create QR codes.
Stars: ✭ 20 (-23.08%)
Mutual labels:  qrcode
qrcode-parser
A pure javascript QR code decoding library, accept PNG File object, PNG image url, image base64.
Stars: ✭ 44 (+69.23%)
Mutual labels:  qrcode
nova-qrcode-field
A Laravel Nova field to generate QR Code
Stars: ✭ 28 (+7.69%)
Mutual labels:  qrcode
Flask-QRcode
A concise Flask extension to easily render QR codes on Jinja2 templates using python-qrcode.
Stars: ✭ 89 (+242.31%)
Mutual labels:  qrcode
escpos-coffee
Java library for ESC/POS printer
Stars: ✭ 172 (+561.54%)
Mutual labels:  qrcode
aliqrcode
自动批量生成支付宝收款码工具
Stars: ✭ 45 (+73.08%)
Mutual labels:  qrcode
flutter scan
scanner qrcode in widget tree & decoder qrcode from image
Stars: ✭ 63 (+142.31%)
Mutual labels:  qrcode

Nepxion Zxing

Total visits Total lines License Maven Central Javadocs Build Status Codacy Badge Stars Stars

           

Nepxion Zxing是一款基于Google Zxing的二维码/条形码生成组件。支持二维码/条形码创建和扫描,支持创建本地图片和字节数组两种格式

简介

参数 说明
text 二维码/条形码内容。二维码可以是文字,也可以是URL,条形码必须是数字
format 二维码/条形码图片格式,例如jpg,png
encoding 二维码/条形码内容编码,例如UTF-8
correctionLevel 二维码/条形码容错等级,例如ErrorCorrectionLevel.H(30%纠正率),ErrorCorrectionLevel.Q(25%纠正率),ErrorCorrectionLevel.M(15%纠正率),ErrorCorrectionLevel.L(7%纠正率)。纠正率越高,扫描速度越慢
width 二维码/条形码图片宽度
height 二维码/条形码图片高度
margin 二维码/条形码图片白边大小,取值范围0~4
foregroundColor 二维码/条形码图片前景色。格式如0xFF000000
backgroundColor 二维码/条形码图片背景色。格式如0xFFFFFFFF
deleteWhiteBorder 二维码图片白边去除。当图片面积较小时候,可以利用该方法扩大二维码/条形码的显示面积
logoFile 二维码Logo图片的文件,File对象。显示在二维码中间的Logo图片,其在二维码中的尺寸最大为100x100左右,否则会覆盖二维码导致最后不能被识别
outputFile 二维码/条形码图片的导出文件,File对象

依赖

<dependency>
  <groupId>com.nepxion</groupId>
  <artifactId>zxing</artifactId>
  <version>${zxing.version}</version>
</dependency>

示例

创建二维码图片并扫描的调用入口

public static void executeForQRFile() {
    // 二维码内容
    String text = "https://github.com/Nepxion/";
    // 二维码图片导出路径
    File file = new File("E:/二维码.jpg");

    // 二维码参数的构造对象,很多参数赋予了默认值,可自行通过set方法更改
    ZxingEntity entity = new ZxingEntity();
    entity.setBarcodeFormat(BarcodeFormat.QR_CODE);
    entity.setLogoFile(new File("src/test/resources/logo.png"));
    entity.setText(text);
    entity.setOutputFile(file);
    entity.setWidth(300);
    entity.setHeight(300);

    // 以文件格式读取并导出,该方式适合本地调用
    ZxingEncoder encoder = new ZxingEncoder();
    encoder.encodeForFile(entity);

    // 以文件格式扫描并解析
    ZxingDecoder decoder = new ZxingDecoder();
    Result result = decoder.decodeByFile(file, entity.getEncoding());

    System.out.println("扫描结果 - [Text] : " + result.getText() + " [Timestamp] : " + result.getTimestamp() + " [BarcodeFormat] : " + result.getBarcodeFormat() + " [NumBits] : " + result.getNumBits());
}

创建二维码图片字节数组(用于网络传递)并扫描的调用入口

public static void executeForQRBytes() throws IOException {
    // 二维码内容
    String text = "https://github.com/Nepxion/";
    // 二维码图片导出路径
    File file = new File("E:/二维码.jpg");

    // 二维码参数的构造对象,很多参数赋予了默认值,可自行通过set方法更改
    ZxingEntity entity = new ZxingEntity();
    entity.setBarcodeFormat(BarcodeFormat.QR_CODE);
    entity.setLogoFile(new File("src/test/resources/logo.png"));
    entity.setText(text);
    entity.setOutputFile(file);
    entity.setWidth(300);
    entity.setHeight(300);

    // 以字节数组格式读取并导出,该方式适合服务端传输给客户端调用
    ZxingEncoder encoder = new ZxingEncoder();
    byte[] bytes = encoder.encodeForBytes(entity);

    ZxingUtils.createFile(bytes, file);

    // 以字节数组格式扫描并解析
    ZxingDecoder decoder = new ZxingDecoder();
    Result result = decoder.decodeByBytes(bytes, entity.getEncoding());

    System.out.println("扫描结果 - [Text] : " + result.getText() + " [Timestamp] : " + result.getTimestamp() + " [BarcodeFormat] : " + result.getBarcodeFormat() + " [NumBits] : " + result.getNumBits());
}

创建条形码图片并扫描的调用入口

public static void executeForEANFile() {
    // 条形码内容
    String text = "6943620593115";
    // 条形码图片导出路径
    File file = new File("E:/条形码.jpg");

    // 条形码参数的构造对象,很多参数赋予了默认值,可自行通过set方法更改
    ZxingEntity entity = new ZxingEntity();
    entity.setBarcodeFormat(BarcodeFormat.EAN_13);
    entity.setText(text);
    entity.setOutputFile(file);
    entity.setWidth(560);
    entity.setHeight(200);

    // 以文件格式读取并导出,该方式适合本地调用
    ZxingEncoder encoder = new ZxingEncoder();
    encoder.encodeForFile(entity);

    // 以文件格式扫描并解析
    ZxingDecoder decoder = new ZxingDecoder();
    Result result = decoder.decodeByFile(file, entity.getEncoding());

    System.out.println("扫描结果 - [Text] : " + result.getText() + " [Timestamp] : " + result.getTimestamp() + " [BarcodeFormat] : " + result.getBarcodeFormat() + " [NumBits] : " + result.getNumBits());
}

创建条形码图片字节数组(用于网络传递)并扫描的调用入口

public static void executeForEANBytes() throws IOException {
    // 条形码内容
    String text = "6943620593115";
    // 条形码图片导出路径
    File file = new File("E:/条形码.jpg");

    // 条形码参数的构造对象,很多参数赋予了默认值,可自行通过set方法更改
    ZxingEntity entity = new ZxingEntity();
    entity.setBarcodeFormat(BarcodeFormat.EAN_13);
    entity.setText(text);
    entity.setOutputFile(file);
    entity.setWidth(560);
    entity.setHeight(200);

    // 以字节数组格式读取并导出,该方式适合服务端传输给客户端调用
    ZxingEncoder encoder = new ZxingEncoder();
    byte[] bytes = encoder.encodeForBytes(entity);

    ZxingUtils.createFile(bytes, file);

    // 以字节数组格式扫描并解析
    ZxingDecoder decoder = new ZxingDecoder();
    Result result = decoder.decodeByBytes(bytes, entity.getEncoding());

    System.out.println("扫描结果 - [Text] : " + result.getText() + " [Timestamp] : " + result.getTimestamp() + " [BarcodeFormat] : " + result.getBarcodeFormat() + " [NumBits] : " + result.getNumBits());
}

运行结果

二维码示例图片

条形码示例图片

请联系我

微信、钉钉、公众号和文档

Star走势图

Stargazers over time

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].