- export(String) - 类 中的静态方法top.lshaci.framework.pdf.ItextPdfUtils
-
Export PDF with html string, use the default fontPath(.
- export(String, OutputStream) - 类 中的静态方法top.lshaci.framework.pdf.ItextPdfUtils
-
Export PDF with html string, use the default fontPath(.
- export(String, String) - 类 中的静态方法top.lshaci.framework.pdf.ItextPdfUtils
-
Export PDF with html string
The html freemarker template need set body style,
For example: <body style = "font-family: SimSun;">
The sample code:
Map<String, Object> data = new HashMap<>();
String htmlStr = FreemarkerUtils.build(Test.class, "/pdf").setTemplate("test.ftl").generate(data);
ByteArrayOutputStream pdfOs = ItextPdfUtils.export(htmlStr, fontPath);
resp.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("测试", "UTF-8") + ".pdf");
resp.setContentType("application/pdf");
ServletOutputStream outputStream = resp.getOutputStream();
outputStream.write(pdfOs.toByteArray());
- export(String, String, OutputStream) - 类 中的静态方法top.lshaci.framework.pdf.ItextPdfUtils
-
Export PDF with html string
The html freemarker template need set body style,
For example: <body style = "font-family: SimSun;">
The sample code:
Map<String, Object> data = new HashMap<>();
String htmlStr = FreemarkerUtils.build(Test.class, "/pdf").setTemplate("test.ftl").generate(data);
resp.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("测试", "UTF-8") + ".pdf");
resp.setContentType("application/pdf");
ItextPdfUtils.export(htmlStr, fontPath, resp.getOutputStream());