首页 > 其他 > 详细

二维码换行

时间:2015-05-04 18:12:00      阅读:307      评论:0      收藏:0      [点我收藏+]

1、代码

<%@page import="erwebma.AddCode"%>
<%@page import="javax.imageio.ImageIO"%>
<%@page import="java.awt.image.BufferedImage"%>
<%@page import="erwebma.client.j2se.MatrixToImageWriter"%>
<%@page import="com.google.zxing.common.BitMatrix"%>
<%@page import="com.google.zxing.MultiFormatWriter"%>
<%@page import="com.google.zxing.BarcodeFormat"%>
<%@page import="com.google.zxing.EncodeHintType"%>
<%@page import="java.util.Hashtable"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String data = request.getParameter("data");
    if (data != null) {
        int width = 128;
        int height = 128;
        String format = "png";
        Hashtable hints = new Hashtable();
        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
        BitMatrix bitMatrix = new MultiFormatWriter().encode(data, BarcodeFormat.QR_CODE, width, height, hints);
        BufferedImage bufi = MatrixToImageWriter.toBufferedImage(bitMatrix);
        response.reset();
        response.setContentType("image/png");
        ImageIO.write(bufi, "png", response.getOutputStream());

        out.clear();
        out = pageContext.pushBody();
    }
%>

2、换行

    换行,用“%0A”。

3、二维码图片

    技术分享

二维码换行

原文:http://blog.csdn.net/class_horse/article/details/45482417

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!