自动化立体仓库 - WMS系统
13
zhang
昨天 82de5a307466894bbb0258f8a63a26a7bb96d80d
src/main/java/com/zy/common/utils/BarcodeUtils.java
@@ -24,17 +24,18 @@
    /**
     * 条形码编码
     */
    public static BufferedImage encode(String string){
    public static BufferedImage encode(String string) {
        return encode(string, null, null);
    }
    public static BufferedImage encode(String string, Integer width, Integer height){
    public static BufferedImage encode(String string, Integer width, Integer height) {
        try {
            Code128Writer writer = new Code128Writer();
            BitMatrix bar = writer.encode(string, BarcodeFormat.CODE_128, width==null?DEFAULT_WIDTH:width, height==null?DEFAULT_HEIGHT:height, new HashMap<>());
            BitMatrix bar = writer.encode(string, BarcodeFormat.CODE_128, width == null ? DEFAULT_WIDTH : width, height == null ? DEFAULT_HEIGHT : height, new HashMap<>());
            return MatrixToImageWriter.toBufferedImage(bar);
        } catch (WriterException e) {
            throw new RuntimeException(e);
        }
        catch (WriterException e){ throw new RuntimeException(e); }
    }
    /**