Browse Source

盖章模板路径分隔符修改

tags/24080901
CMM 1 year ago
parent
commit
1c57e2ec0c
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  2. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -1037,7 +1037,7 @@ public class TodoCenterManage {
// 获取本地目录的pdf模板
String fileName = "预审申请单";
InputStream htmlInputStream =
this.getClass().getClassLoader().getResourceAsStream("template/" + fileName + ".html");
this.getClass().getClassLoader().getResourceAsStream("template" + java.io.File.separator + fileName + ".html");
// 生成pdf字节数组
byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap);



+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java View File

@@ -44,13 +44,13 @@ public class PdfUtils {
File directory = new File("");
//pdf输出路径
String absolutePath = directory.getAbsolutePath();
String linkPath = "\\pmapi\\src\\main\\resources";
String filePath = absolutePath + linkPath + "\\template\\fileout";
String linkPath = File.separator + "pmapi" + File.separator + "src" + File.separator + "main" + File.separator + "resources";
String filePath = absolutePath + linkPath + File.separator + "template" + File.separator + "fileout";
if(!new File(filePath).exists()){
new File(filePath).mkdir();
}
//字体格式
String FONT = absolutePath + linkPath + "\\template\\simsun.ttc";
String FONT = absolutePath + linkPath + File.separator + "template" + File.separator + "simsun.ttc";
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8));
String line;


Loading…
Cancel
Save