From 1c57e2ec0ca385a52b4dde4b6aa4c13d7e28f708 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 17 Mar 2023 13:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=96=E7=AB=A0=E6=A8=A1=E6=9D=BF=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=88=86=E9=9A=94=E7=AC=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java | 2 +- .../main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 5eefa62..92144e1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/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); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java index cb519a9..9545b00 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java +++ b/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;