Selaa lähdekoodia

修改临时文件输出路径

tags/24080901
CMM 1 vuosi sitten
vanhempi
commit
1501a1091b
1 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. +4
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java

+ 4
- 5
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/utils/PdfUtils.java Näytä tiedosto

@@ -44,14 +44,13 @@ public class PdfUtils {

try {
File directory = new File("");
//pdf输出路径
//临时文件输出路径
String filePath = directory.getAbsolutePath() + File.separator + "fileout";
String templatePath = ResourceUtil.getResource("").getPath();
//字体格式
String fontPath = ResourceUtil.getResource("template/simsun.ttc").getPath();
if(!new File(filePath).exists()){
new File(filePath).mkdir();
}
//字体格式
String FONT = templatePath + "template" + File.separator + "simsun.ttc";
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8));
String line;
@@ -93,7 +92,7 @@ public class PdfUtils {
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
ITextFontResolver fontResolver = renderer.getFontResolver();
fontResolver.addFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
fontResolver.addFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.layout();
renderer.createPDF(os);
os.flush();


Loading…
Peruuta
Tallenna