-
使用 itext、flying-saucer 实现html转PDF下载
资源介绍
ITextRenderer renderer = new ITextRenderer();
ITextFontResolver fontResolver = renderer.getFontResolver();
fontResolver.addFont("C:/Windows/fonts/simsun.ttc", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
os = new ByteArrayOutputStream();
String htmlstr = "你的HTML字符串";
renderer.setDocumentFromString(htmlstr);
renderer.layout();