From 10d7b3239e4baec952b9ee8a3e948399916d336c Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 20 十月 2025 08:23:58 +0800
Subject: [PATCH] 13
---
src/main/java/com/zy/common/utils/BarcodeUtils.java | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/BarcodeUtils.java b/src/main/java/com/zy/common/utils/BarcodeUtils.java
index f2912db..6d25bd9 100644
--- a/src/main/java/com/zy/common/utils/BarcodeUtils.java
+++ b/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); }
}
/**
--
Gitblit v1.9.1