本文主要是介绍java zxing QR 二维码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
google zxing 依赖包
<dependency><groupId>com.google.zxing</groupId><artifactId>javase</artifactId><version>3.2.1</version> </dependency>
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
String text = "hello world 2015.12.30";
String path = "E:\\hello-world.jpg";Map< EncodeHintType, String > hints = new HashMap< EncodeHintType, String >();
hints.put( EncodeHintType.CHARACTER_SET, "UTF-8" );BitMatrix bitMatrix = new MultiFormatWriter().encode( text, BarcodeFormat.QR_CODE, 400, 400, hints );
MatrixToImageWriter.writeToPath( bitMatrix, "jpg", Paths.get( path ) );
这篇关于java zxing QR 二维码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!