瀏覽代碼

盖章模板路径分隔符修改

tags/24080901
CMM 1 年之前
父節點
當前提交
1c57e2ec0c
共有 2 個文件被更改,包括 4 次插入4 次删除
  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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存