产品说条形码模糊,然后就生成了矢量的条形码给前端用。后面才知道前端是可以自己直接生成的。
还是记录一下
遇到一个奇怪的问题,在demo工程里面请求返回的流页面能直接显示出图形。但是在项目工程里面却返回的是xml形式的字符串。这里搞了一阵。后面无意间发现。直接返回String形式的svg文件内容,前端居然可以显示。然后后台直接返回了Sting形式给前端直接用。样式也是调好的。加了width="100%‘’方便前端控制宽度。之前直接返回流前端用不了。

参考代码

    <dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>2.2</version></dependency><dependency><groupId>de.erichseifert.vectorgraphics2d</groupId><artifactId>VectorGraphics2D</artifactId><version>0.9.3</version></dependency><dependency><groupId>net.sf.barcode4j</groupId><artifactId>barcode4j</artifactId><version>2.1</version></dependency>@RequestMapping("/bar")@ResponseBodypublic String getbar(HttpServletResponse response,String code) {String res = null;try {res = BarcodeTestTools.getcode3(response,code);log.info("返回的结果={}",res);res = res.replace("<svg","<svg width=\"100%\"");} catch (Exception e) {System.out.println(e);}System.out.println("返回结果==="+res);return res;}public static String getcode3(HttpServletResponse response,String code) throws BarcodeCanvasSetupException, TransformerException, IOException {ServletOutputStream out = response.getOutputStream();response.reset();Double moduleWidth = Double.valueOf(1.0D);double dpi = 150;Double width = 5d;Code128Bean bean = new Code128Bean();String barcode = code;Integer barcodeLength = Integer.valueOf(barcode.length());if (barcodeLength.intValue() < 8){moduleWidth = Double.valueOf(2.0D * width.doubleValue());}else if (barcodeLength.intValue() < 16){moduleWidth = width;}if (moduleWidth.doubleValue() < 1.0D){moduleWidth = Double.valueOf(1.0D);}bean.setModuleWidth(UnitConv.in2mm(moduleWidth.doubleValue() / dpi));
//        bean.setModuleWidth(80);
//        bean.setHeight(60);bean.setBarHeight(30);// 高度
//        bean.setQuietZone(10); // 向右偏移bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);// 设置两侧是否加空白bean.doQuietZone(false);SVGCanvasProvider canvas = new SVGCanvasProvider(true, 0);bean.generateBarcode(canvas, barcode);DocumentFragment frag = canvas.getDOMFragment();TransformerFactory factory = TransformerFactory.newInstance();Transformer trans = factory.newTransformer();Source src = new DOMSource(frag);File tempFile = File.createTempFile("bar",".svg");Result res = new StreamResult(tempFile);// 入参file则写到文件里面; 这里没必要这么搞,直接StringWriter写过去就可以,参考下面更新部分         response.getOutputStream()就直接写到返回流里面trans.transform(src, res);FileReader fileReader = new FileReader(tempFile);BufferedReader bufferedReader = new BufferedReader(fileReader);StringBuilder sb = new StringBuilder();String line =bufferedReader.readLine();while (line!=null){System.out.println(line);sb.append(line);line = bufferedReader.readLine();}bufferedReader.close();fileReader.close();tempFile.delete();return sb.toString();}

二维码

  @RequestMapping("/qr")@ResponseBodypublic String jxxqr(HttpServletResponse response,String code,int size) throws IOException, WriterException {String res = Test.getQr(response,code,size);System.out.println("qr====="+res);return res;}public static String getQr(HttpServletResponse response,String code,int size) throws WriterException, IOException {double point_x = 0;double point_y = 0;final int blockSize = 1;SVGGraphics2D funcOld = new SVGGraphics2D(point_x, point_y, 40 * blockSize, 40 * blockSize);ExportQrCode.fill2VectorLine(funcOld,GetBitMatrix(code, size,ErrorCorrectionLevel.M), blockSize);File tempFile = File.createTempFile("bar",".svg");PrintStream psFile = new PrintStream(tempFile);psFile.append(funcOld.toString());psFile.close();FileReader fileReader = new FileReader(tempFile);BufferedReader bufferedReader = new BufferedReader(fileReader);StringBuilder sb = new StringBuilder();String line =bufferedReader.readLine();while (line!=null){sb.append(line);line = bufferedReader.readLine();}bufferedReader.close();fileReader.close();tempFile.delete();return sb.toString();}页面
<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head><meta charset="utf-8"><meta name="description" content="particles.js is a lightweight JavaScript library for creating particles."><meta name="author" content="Vincent Garreau" /><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>testsvg</title>
</head><style type="text/css">.svg-container {display: inline-block;position: relative;width: 100%;padding-bottom: 100%;vertical-align: middle;overflow: hidden;}
</style>
<body><div style="width: 100%;background-color: gray;height: 90px;"></div><div style="width: 100%;height: 120px;"><div style="margin-left:10px;float: left;width: 45%;height:100px;background-color: #00FF00"><div class="svg-container" id="showbox"></div></div><div style="float: left;width: 45%;height:100px; background-color:green;margin-left: 5px; "><div class="svg-container" id="showbox2" style="margin-top: -20px;"></div></div>
</div><div style="height: 400px;width:100%;float: left;" data-test="写死的二维码"><svg version="1.2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0mm" y="0mm" width="40mm" height="40mm" viewBox="0 0 40 40"><style type="text/css"><![CDATA[text { font:12px Dialog; }]]></style><rect x="9" y="9" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="9" y="17" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="9" y="21" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="9" y="23" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="19" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="21" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="10" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="17" width="1" height="4" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="25" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="11" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="17" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="25" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="12" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="17" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="25" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="13" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="17" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="19" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="14" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="15" y="9" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="15" y="17" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="15" y="19" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="15" y="21" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="15" y="23" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="16" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="17" y="11" width="1" height="6" style="fill:rgb(0,0,0);stroke:none" /><rect x="17" y="18" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="17" y="22" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="17" y="24" width="1" height="4" style="fill:rgb(0,0,0);stroke:none" /><rect x="17" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="18" y="10" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="18" y="13" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="18" y="17" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="18" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="18" y="25" width="1" height="5" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="10" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="13" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="18" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="21" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="25" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="19" y="27" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="9" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="14" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="17" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="25" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="20" y="28" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="21" y="10" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="21" y="12" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="21" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="21" y="18" width="1" height="5" style="fill:rgb(0,0,0);stroke:none" /><rect x="21" y="26" width="1" height="4" style="fill:rgb(0,0,0);stroke:none" /><rect x="22" y="18" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="22" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="22" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="22" y="25" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="22" y="28" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="23" y="9" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="23" y="17" width="1" height="4" style="fill:rgb(0,0,0);stroke:none" /><rect x="23" y="26" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="17" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="19" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="21" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="24" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="27" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="24" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="25" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="25" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="25" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="25" y="17" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="25" y="23" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="17" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="26" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="26" y="28" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="11" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="17" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="20" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="22" width="1" height="4" style="fill:rgb(0,0,0);stroke:none" /><rect x="27" y="29" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="9" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="15" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="18" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="20" width="1" height="2" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="24" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="28" y="28" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /><rect x="29" y="9" width="1" height="7" style="fill:rgb(0,0,0);stroke:none" /><rect x="29" y="18" width="1" height="3" style="fill:rgb(0,0,0);stroke:none" /><rect x="29" y="23" width="1" height="1" style="fill:rgb(0,0,0);stroke:none" /></svg>
</div>
<!-- scripts -->
<script th:src="@{/js/particles.js}"></script>
<script th:src="@{/js/app.js}"></script>
<script th:src="@{/js/jquery-3.4.1.min.js}"></script>
<script th:src="@{/js/layui/layui.js}"></script>
<script>$(function(){var ctxPath  = [[@{/}]];var ctxPath=[[${#httpServletRequest.getContextPath()}]]/;$.get(ctxPath +"/ban/qr?code=123456&size=40", function(result2){console.log(result2);$("#showbox2").html(result2);});$.get(ctxPath +"/ban/bar3?code=123456789", function(result){console.log(result);$("#showbox").html(result);});});</script>
</body>
</html>

2021-07-16 14:21:17 更新
优惠券换新版了,用矢量二维码和条形码。把之前的代码整理了一下。矢量的优点是随意放大不失真。这就很棒了!

实验发现,使用上面生成的二维码会出现白线,类似打印机坏了,一个像素没打印一样。

类似这种 谷歌找了一下,换了种方式后没有这个问题了 记录一下 生成的二维码很干净

另外值得注意的是 response.getOutputStream()不需要手动关闭。在servlet运行完毕时自动flush和close

 package com.mb.sleep.sleep.utils;import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import org.krysalis.barcode4j.HumanReadablePlacement;
import org.krysalis.barcode4j.impl.code128.Code128Bean;
import org.krysalis.barcode4j.output.BarcodeCanvasSetupException;
import org.krysalis.barcode4j.output.svg.SVGCanvasProvider;
import org.krysalis.barcode4j.tools.UnitConv;
import org.w3c.dom.DocumentFragment;import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;public class BarQrCodeService {/*** 条形码** @param code* @return* @throws BarcodeCanvasSetupException* @throws TransformerException* @throws IOException*/public static String getBarCodeSVGStr(String code) throws Exception {Double moduleWidth = Double.valueOf(1.0D);//分辨率double dpi = 300;Double width = 6d;Code128Bean bean = new Code128Bean();String barcode = code;Integer barcodeLength = Integer.valueOf(barcode.length());if (barcodeLength.intValue() < 8) {moduleWidth = Double.valueOf(2.0D * width.doubleValue());} else if (barcodeLength.intValue() < 16) {moduleWidth = width;}if (moduleWidth.doubleValue() < 1.0D) {moduleWidth = Double.valueOf(1.0D);}bean.setModuleWidth(UnitConv.in2mm(moduleWidth.doubleValue() / dpi));bean.setBarHeight(30);// 高度bean.setQuietZone(60); // 向右偏移bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);// 设置两侧是否加空白bean.doQuietZone(false);SVGCanvasProvider canvas = new SVGCanvasProvider(true, 0);bean.generateBarcode(canvas, barcode);DocumentFragment frag = canvas.getDOMFragment();TransformerFactory factory = TransformerFactory.newInstance();Transformer trans = factory.newTransformer();Source src = new DOMSource(frag);StringWriter outw = new StringWriter();trans.transform(src, new StreamResult(outw));return outw.toString();}/*** 条形码写流* @param response* @param code* @throws BarcodeCanvasSetupException* @throws TransformerException* @throws IOException*/public static void getBarCodeSVGStrOut(HttpServletResponse response, String code) throws Exception {Double moduleWidth = Double.valueOf(1.0D);//分辨率double dpi = 300;Double width = 6d;Code128Bean bean = new Code128Bean();String barcode = code;Integer barcodeLength = Integer.valueOf(barcode.length());if (barcodeLength.intValue() < 8) {moduleWidth = Double.valueOf(2.0D * width.doubleValue());} else if (barcodeLength.intValue() < 16) {moduleWidth = width;}if (moduleWidth.doubleValue() < 1.0D) {moduleWidth = Double.valueOf(1.0D);}bean.setModuleWidth(UnitConv.in2mm(moduleWidth.doubleValue() / dpi));bean.setBarHeight(30);// 高度bean.setQuietZone(60); // 向右偏移bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);// 设置两侧是否加空白bean.doQuietZone(false);SVGCanvasProvider canvas = new SVGCanvasProvider(true, 0);bean.generateBarcode(canvas, barcode);DocumentFragment frag = canvas.getDOMFragment();TransformerFactory factory = TransformerFactory.newInstance();Transformer trans = factory.newTransformer();Source src = new DOMSource(frag);trans.transform(src, new StreamResult(response.getOutputStream()));}/*** 二维码** @param code* @param size* @return* @throws WriterException* @throws IOException*/public static String getqrSVGStr(String code, int size) throws Exception {return createQRStr(code,size);}/*** 二维码 写流** @param response* @param code* @param size* @return* @throws WriterException* @throws IOException*/public static void getqrSVGStrOut(HttpServletResponse response, String code, int size) throws Exception {response.getOutputStream().write(createQRStr(code,size).getBytes(StandardCharsets.UTF_8));}/*** 生成svg字符串* @param code* @param size* @return* @throws Exception*/private static String createQRStr(String code, int size) throws Exception {QRCodeWriter qrCodeWriter = new QRCodeWriter();Map<EncodeHintType, Object> hints = new HashMap<>();hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);hints.put(EncodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name());BitMatrix bitMatrix = qrCodeWriter.encode(code, BarcodeFormat.QR_CODE, size, size, hints);StringBuilder sbPath = new StringBuilder();int width = bitMatrix.getWidth();int height = bitMatrix.getHeight();BitArray row = new BitArray(width);for (int y = 0; y < height; ++y) {row = bitMatrix.getRow(y, row);for (int x = 0; x < width; ++x) {if (row.get(x)) {sbPath.append(" M" + x + "," + y + "h1v1h-1z");}}}StringBuilder sb = new StringBuilder();sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");sb.append("<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 ").append(width).append(" ").append(height).append("\" stroke=\"none\">\n");sb.append("<style type=\"text/css\">\n");sb.append(".black {fill:#000000;}\n");sb.append("</style>\n");sb.append("<path class=\"black\"  d=\"").append(sbPath).append("\"/>\n");sb.append("</svg>\n");return sb.toString();}}需要的依赖 <!--zxing二维码生成 -->
<dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>3.3.1</version>
</dependency>
<dependency><groupId>com.google.zxing</groupId><artifactId>javase</artifactId><version>3.2.1</version>
</dependency>
<dependency><groupId>de.erichseifert.vectorgraphics2d</groupId><artifactId>VectorGraphics2D</artifactId><version>0.9.3</version>
</dependency>
<dependency><groupId>net.sf.barcode4j</groupId><artifactId>barcode4j</artifactId><version>2.1</version>
</dependency>
<dependency><groupId>de.erichseifert.vectorgraphics2d</groupId><artifactId>VectorGraphics2D</artifactId><version>0.9.3</version>
</dependency>

java生成矢量条形码二维码相关推荐

  1. java生成以及解析二维码

    java生成以及解析二维码 欢迎使用Markdown编辑器 新的改变 功能快捷键 合理的创建标题,有助于目录的生成 如何改变文本的样式 插入链接与图片 如何插入一段漂亮的代码片 生成一个适合你的列表 ...

  2. Java生成和解析二维码工具类(简单经典)

    Java生成和解析二维码工具类 开箱即用,简单不废话. pom.xml引入依赖 <!-- https://mvnrepository.com/artifact/com.google.zxing/ ...

  3. java生成和识别二维码

    全栈工程师开发手册 (作者:栾鹏) java教程全解 本文使用两种方式生成和识别二维码. 方法1:使用日本公司的qrcode 需要引入的包 qrcode_swetake.jar qrcode.jar ...

  4. Java生成与解析二维码

    1.下载支持二维码的jar包qrcode.jar和qrcode_swetake.jar, 其中qrcode_swetake.jar用于生成二维码,rcode.jar用于解析二维码,jar包下载地址(免 ...

  5. 用 Java 生成和识别二维码就这么简单

    大家好,我是青空. 青空最近一直在思考一个问题,Java 能不能做一些比较有意思的事情,但是在网络上搜索的时候,有意思好玩的东西,都被 Python 给做了.Java 似乎就只剩下八股文,面试,框架, ...

  6. java生成两种二维码

    引言 在这篇博客中关于二维码的基本原理先不做介绍,先介绍我们怎样利用java语言实现二维码的生成,现在二维 码在我们生活中已经非常常见了,一言不合就扫码!所以对于我们这帮程序猿来说,需要研究一把这个东 ...

  7. Java生成和解析二维码

    前言:曾经有做过不少微信公众号和移动网站的项目,对二维码还算有点了解,刚收到这个任务的时候就想着竟然要用二维码存文本,那就得先考究一下这小小的二维码到底能存多少的东西了. 需求:使用二维码存放文本(x ...

  8. 用java生成一个表白二维码

    之前对二维码粗略的看了一下觉得可以自己实现一个二维码用来表白,程序员的浪漫. 其实生成一个二维码非常简单几个类就可以搞定 import java.io.File; import java.nio.fi ...

  9. java生成和解析二维码实战——QRCode

    直接上代码,以下程序可直接运行: package qrcode;import java.awt.Color; import java.awt.Graphics2D; import java.awt.i ...

最新文章

  1. oracle 四分位函数,Oracle分析函数四——函数RANK,DENSE_RANK,FIRST,LAST…
  2. 为Apache动态增加模块
  3. 《JAVA与模式》之策略模式
  4. GDCM:制作模板的测试程序
  5. C++map容器-构造和赋值
  6. string类的基本实现
  7. 2017php行情,2017年蔬菜行情特点及未来蔬菜价格走势分析
  8. 小程序字符串拼接_小程序突袭预约!Yeezy 350quot;氧化满天星quot;拼接配色本月发售!...
  9. @程序员,欠下的技术债怎么还?
  10. 【2021】重装ubuntu16.04系统
  11. xml 解析库 msxml6.dll
  12. 东方时尚驾校-科目三-雪铁龙-考试技巧
  13. 《Learning_object_interactions_and_descriptions_for_sematic_image》论文阅读
  14. 验证码漏洞汇总(一)
  15. MySQL 报错InnoDB: Cannot allocate memory for the buffer poo处理方法
  16. mq中消息消费的几种方式
  17. 计算机启动灯1212,惠普笔记本电脑型号F6C27PA#AB2wifi开关一直亮红灯开不起怎么办?...
  18. Windows10官方镜像-U盘安装盘制作
  19. 如何用c++计算加减乘除
  20. 计算思维与计算机导论,计算思维与计算机导论_董荣胜.pdf

热门文章

  1. 中国银联DNA手机支付接口
  2. java web设置首页_java web设置默认首页方法
  3. Eaglooe 学习日记1
  4. 小程序 timestamp_通过构建Timestamp微服务应用程序来学习Node.js
  5. XPE及CE系统对比
  6. csgo服务器响应参数,csgo必备弹道参数 影响弹道参数设置
  7. 阿里云的「香港」机房大陆访问速度怎么样?
  8. 计算机英语发展,计算机发展史(英语版)
  9. MATLAB之傅里叶展开(五)
  10. git下载,上传代码到GitLab ; Untracked files (use “git add <file>...“ to include in what will be committed)