提问人:SOJSON用户
提问日期:2017-02-22 23:01
热度:49
//二维码内容
String text = "你好";
int width = 100; //宽
int height = 100; //高
String format = "png"; //图片格式
Hashtable hints= new Hashtable();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height,hints);
//输出二维码目录
File outputFile = new File("F:/new.png");
MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile);
0条回答
我来回答