修改生成英文证书时英文完整换行

This commit is contained in:
wuchunlei
2025-09-10 14:32:02 +08:00
parent a8ab78e517
commit c2b536336a

View File

@@ -300,9 +300,6 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateDao,
g.setFont(new Font("Arial", Font.PLAIN, 32));
FontMetrics dess = g.getFontMetrics();
int alreadyWriteLine = 0; //已经写了多少行
int nowWidth = 0; //目前一行的长度
boolean space = true; //第一行空两格
String des = "";
if ("ZK".equals(type)){
des = "Has past the online-examination study of "+edes[0]+" Courses in Tai Hu Education online.";
@@ -310,9 +307,10 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateDao,
des = "Has satisfactorily completed an online course on "+edes[0]+" with "+edes[1]+" course hours in total, and has been recongnized eligibility without assessment.";
}
String str = "";
int alreadyWriteLine = 0; //已经写了多少行
int nowIndex = 0; //目前一行的长度
for (int i = 0; i < des.length(); i++) { //9
String tempStr = "";
String tempStr;
str = str + des.charAt(i);
int strWidth = dess.stringWidth(str.substring(nowIndex)); //获取字符的长度
if (strWidth>700) {//换行