二维码生成代码java 二维码生成代码实现

java哪种方式生成二维码比较好最简单的方式使用jQuery的qrCode插件
[html] view plain copy
!DOCTYPE html
html
head
meta charset="UTF-8"
title使用JQueryQrCode生成二维码/title
script type="text/javascript" src="https://www.04ip.com/post/js/jquery-1.9.1.min.js"/script
script type="text/javascript" src="https://www.04ip.com/post/js/qrcode.js"/script
/head
body
div id="qrcode"/div
script type="text/javascript"
//参数1表示图像大小,取值范围1-10;参数2表示质量,取值范围'L','M','Q','H'
var content = "使用JQueryQrCode生成二维码"
var qr = qrcode(8, 'M');
qr.addData(content);
qr.make();
/* var dom=document.createElement('DIV');
dom.innerHTML = qr.createImgTag();
var element=document.getElementById("qrcode");
element.appendChild(dom); */
$("#qrcode").html(qr.createImgTag());
/script
/body
/html
我已经用java生成了一个二维码了,怎样让扫描二维码后 , 读取到一个word文档 , 大神 。不用这么麻烦二维码生成代码java , 直接使用二维码生成器就行了二维码生成代码java,只要上传文档,自动直接生成二维码 。方便有快捷 。
推荐一款目前市面上比较不错的二维码生成工具 。
登录网站进入操作后台 。
点击添加二维码内容 。(可查看管理制作过的二维码 , 如果是第一次使用直接显示第三步的编辑页面 。
3.编辑二维码里的内容 , 上传你的文档 。
上传完成后保存即可生成二维码,并且生成的二维码内容支持随时修改,原码不变二维码生成代码java!
希望对你有帮助!
java生成二维码如何去除白边java生成二维码如何去除白边
新代码:(注意点查看图片截图二维码生成代码java的标注) MapEncodeHintType, Object hints = new HashMapEncodeHintType, Object(); hints.put(EncodeHintType.MARGIN
java 生成二维码后如何给该二维码添加信息java可使用zxing生成二维码并为其添加信息 。
以下是详细步骤:
1、创建MatrixToImageWriter类
import com.google.zxing.common.BitMatrix;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.OutputStream;
import java.io.IOException;
import java.awt.image.BufferedImage;

public final class MatrixToImageWriter {
private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF;
private MatrixToImageWriter() {}

public static BufferedImage toBufferedImage(BitMatrix matrix) {
int width = matrix.getWidth();
int height = matrix.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; xwidth; x) {
for (int y = 0; yheight; y) {
image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
}
}
return image;
}

public static void writeToFile(BitMatrix matrix, String format, File file)
throws IOException {
BufferedImage image = toBufferedImage(matrix);
if (!ImageIO.write(image, format, file)) {
throw new IOException("Could not write an image of format "format" to "file);
}
}

public static void writeToStream(BitMatrix matrix, String format, OutputStream stream)
throws IOException {
BufferedImage image = toBufferedImage(matrix);
if (!ImageIO.write(image, format, stream)) {
throw new IOException("Could not write an image of format "format);
}
}
}
2、生成二维码并添加信息
import java.io.File;
import java.util.Hashtable;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
public class Test {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String text = "";
int width = 300;
int height = 300;
//二维码的图片格式
String format = "gif";
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("d:" File.separator "new.gif");
MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile);
}
}
【二维码生成代码java 二维码生成代码实现】关于二维码生成代码java和二维码生成代码实现的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读