|
|
@@ -3,7 +3,6 @@ package me.zhengjie.base.util;
|
|
|
import com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder;
|
|
|
import com.openhtmltopdf.pdfboxout.PdfRendererBuilder;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import me.zhengjie.sign.connector.HttpClient;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.helper.W3CDom;
|
|
|
@@ -118,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), "SimSun", 0, BaseRendererBuilder.FontStyle.NORMAL, true);
|
|
|
- builder.useFont(new File(fontPath + simfangPath), "simfang", 0, BaseRendererBuilder.FontStyle.NORMAL, true);
|
|
|
+ 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.run();
|
|
|
}
|