zxing生成二维码以流式传到页面
来源:互联网 发布:汕头大学网络教育 编辑:程序博客网 时间:2024/05/24 16:17
@RequestMapping(“/makeQrCode”)
public void madeQrCode(HttpServletResponse res,String content,Integer width,Integer height) throws IOException{
String format = "png"; content = (content == null || "".equals(content) ? "http://www.manjiwang.com" : content); width = (width == null ? 300 : width); height = (height == null ? 300 : height); System.out.println(content); System.out.println(width); System.out.println(height); if(content != null && !"".equals(content)){ ServletOutputStream stream = null; try { //定义二维码的参数 HashMap hints = new HashMap(); hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); hints.put(EncodeHintType.MARGIN, 2); //生成二维码 stream = res.getOutputStream(); BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height , hints); MatrixToImageWriter.writeToStream(bitMatrix, format, stream); } catch (WriterException e) { e.printStackTrace(); }finally{ if(stream != null){ stream.flush(); stream.close(); } }}}
前端页面接收
$(“#image”).attr(“src”,”/backstage/makeQrCode?content=”+content+”&width=”+width+”&height=”+height);
0 0
- zxing生成二维码以流式传到页面
- 利用ZXing生成二维码
- ZXing二维码生成
- ZXing生成二维码
- 采用zxing生成二维码
- 利用Zxing生成二维码
- 使用zxing生成二维码
- 使用ZXing生成二维码
- 使用zxing生成二维码
- zxing生成二维码
- google ZXing 生成二维码
- 使用zxing生成二维码
- zxing生成二维码
- **利用Zxing生成二维码
- Android zxing生成二维码
- ZXing生成二维码
- 使用zxing生成二维码
- Zxing生成二维码
- margin使用两大bug
- 1002. 写出这个数 (20)
- 自定义View与ViewGroup
- 创业。
- PPFish-NOIP模拟题2015题解
- zxing生成二维码以流式传到页面
- 利用互斥锁+条件变量进行奇偶交替打印
- 背包问题详解:01背包、完全背包、多重背包
- 工作计划
- 打造你的开发神器——介绍Android Studio上的几个插件
- Android Intent设置类型setType()-调用手机默认分享和读取相册图片
- 利用互斥锁+条件变量进行奇偶交替打印
- 商业计划书的建议
- Mac下查看本地ip的方法