From a8f13d72b9c29428a31c1372b7f9557cfb4df5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=A4=B4=E4=BA=BA?= <3076767823@qq.com> Date: Mon, 20 Jan 2025 14:16:50 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=8E=B7=E5=8F=96=E4=BB=A5=E5=8F=8Ahtml=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TemplateService.java | 4 ++ .../impl/USBImagePrintServiceImpl.java | 6 +- src/main/resources/templates/hospital.html | 56 +++++++++---------- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/TemplateService.java b/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/TemplateService.java index 783e770..8c5b077 100644 --- a/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/TemplateService.java +++ b/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/TemplateService.java @@ -271,6 +271,10 @@ public class TemplateService { sharedContext.setInteractive(false); sharedContext.setDPI(256f); + // 使用系统默认字体,假设系统默认字体支持UTF - 8 + Font font = new Font(Font.DIALOG, Font.PLAIN, 20); + graphics.setFont(font); + // 使用Dimension对象进行布局 renderer.layout(graphics, dimension); renderer.render(graphics); diff --git a/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/USBImagePrintServiceImpl.java b/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/USBImagePrintServiceImpl.java index 6c69750..b9f2038 100644 --- a/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/USBImagePrintServiceImpl.java +++ b/src/main/java/com/dpkj/modules/autoReplyPrint/service/impl/USBImagePrintServiceImpl.java @@ -24,7 +24,11 @@ public class USBImagePrintServiceImpl extends BaseImagePrint implements ImagePri @Override public Pointer getHandle(String devName) { try { - return AutoReplyPrint.INSTANCE.CP_Port_OpenUsb(devName, 1); + Pointer pointer = AutoReplyPrint.INSTANCE.CP_Port_OpenUsb(devName, 1); + if ( pointer == null ){ + throw new RRException(); + } + return pointer; }catch (Exception e){ e.printStackTrace(); throw new RRException("获取USB句柄失败"); diff --git a/src/main/resources/templates/hospital.html b/src/main/resources/templates/hospital.html index 9af1b07..8a15663 100644 --- a/src/main/resources/templates/hospital.html +++ b/src/main/resources/templates/hospital.html @@ -4,37 +4,37 @@