Преглед на файлове

html转pdf切换成OpenPDF

sakuya преди 3 години
родител
ревизия
118b9be90e
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      eladmin-system/src/main/java/me/zhengjie/base/util/HtmlConvertToPdf.java

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/base/util/HtmlConvertToPdf.java

@@ -117,8 +117,8 @@ public class HtmlConvertToPdf implements InitializingBean {
 		//引入指定字体,注意字体名需要和css样式中指定的字体名相同
 		String fontPath = HtmlConvertToPdf.class.getClassLoader().getResource("").getPath();
 		System.out.println(fontPath);
-		builder.useFont(new File(fontPath + simsumPath.substring(simsumPath.indexOf("/") + 1)), "SimSun", 0, BaseRendererBuilder.FontStyle.NORMAL, true);
-		builder.useFont(new File(fontPath + simfangPath.substring(simfangPath.indexOf("/") + 1)), "simfang", 0, BaseRendererBuilder.FontStyle.NORMAL, true);
+		builder.useFont(new File(fontPath + simsumPath.substring(simsumPath.indexOf("/") + 1)), "SimSun", 400, BaseRendererBuilder.FontStyle.NORMAL, true);
+		builder.useFont(new File(fontPath + simfangPath.substring(simfangPath.indexOf("/") + 1)), "simfang", 400, BaseRendererBuilder.FontStyle.NORMAL, true);
 
 		builder.run();
 	}