fix:优化模板获取以及html模板

This commit is contained in:
2025-01-20 14:16:50 +08:00
parent 44a175aa66
commit a8f13d72b9
3 changed files with 37 additions and 29 deletions

View File

@@ -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);

View File

@@ -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句柄失败");