Sfoglia il codice sorgente

斑马打印测试

zhuhao 2 anni fa
parent
commit
7bd2cade3f

+ 8 - 8
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/qRcode/ImageProducerUtil.java

@@ -34,7 +34,7 @@ public class ImageProducerUtil {
 
         Font font1 = new Font("黑体", Font.BOLD, 36);//标题字体
         Font font2 = new Font("宋体", Font.BOLD, 28);//内容字体
-        Font font3 = new Font("宋体", Font.BOLD, 20);//编号字体
+        Font font3 = new Font("宋体", Font.BOLD, 16);//编号字体
 
         // 创建图片
         BufferedImage image = new BufferedImage(480, 320, BufferedImage.TYPE_INT_BGR);// 创建图片画布
@@ -44,16 +44,16 @@ public class ImageProducerUtil {
         g.setColor(Color.black);// 再换成黑色,以便于写入文字
         //g.setFont(font1);// 设置画笔字体
 //		g.drawString("样品标识", 120, 42);// 画出一行字符串
-//		g.setFont(font2);
-//		g.drawString("产品名称:", 5, 74);
+		g.setFont(font3);
+		g.drawString("产品名称:", 3, 74);
         g.setFont(font3);
-        g.drawString("产品名称: 前格框", 5, 116);
+        g.drawString("前格框", 3, 116);
         g.setFont(font3);
-//		g.drawString("日期:", 5, 140);
-//		g.setFont(font3);
-        g.drawString("日期: " + DateUtil.formatTimeByStrFormat("yyyy-MM-dd HH:mm:ss", new Date()), 5, 180);
+		g.drawString("生产日期:", 3, 158);
+		g.setFont(font3);
+        g.drawString( DateUtil.formatTimeByStrFormat("yyyy-MM-dd HH:mm:ss", new Date()), 3, 200);
         g.setFont(font3);
-        g.drawString("云箭集团", 10, 245);
+        g.drawString("云箭集团", 3, 242);
 
         //二维码
         TwoDimensionCode handler = new TwoDimensionCode();