packagecom.lnjecit.util;importcom.lowagie.text.pdf.BaseFont;importorg.slf4j.Logger;importorg.slf4j.LoggerFactory;importorg.springframework.util.ResourceUtils;importorg.xhtmlrenderer.pdf.ITextFontResolver;importorg.xhtmlrenderer.pdf.ITextRenderer;import java.io.*;importjava.net.MalformedURLException;/*** Pdf处理工具类
*
*@author* @create 2017-12-18 21:25
**/
public classPdfUtil {protected static Logger logger = LoggerFactory.getLogger(PdfUtil.class);/***
*@paramhtmlFile html文件存储路径
*@parampdfFile 生成的pdf文件存储路径
*@paramchineseFontPath 中文字体存储路径*/
public static voidhtml2pdf(String htmlFile, String pdfFile, String chineseFontPath) {//step 1
String url;
OutputStream os= null;try{
url= newFile(htmlFile).toURI().toURL().toString();
os= newFileOutputStream(pdfFile);
ITextRenderer renderer= newITextRenderer