使用wkhtmltopdf创建PDF文件
参考资料:
https://stackoverflow.com/questions/33146021/generating-pdf-with-wkhtmltopdf-and-download-the-pdf#
https://github.com/topics/html-to-pdf
https://www.petrikainulainen.net/programming/spring-framework/spring-from-the-trenches-creating-pdf-documents-with-wkhtmltopdf/
http://www.laozhaimen.com/article/143508.html
String inputPath = new File("/file.xhtml").toURI().toURL().toString();
f.getAbsolutePath()
String inputPath = new File("/file.xhtml").toURI().toURL().toString(); OutputStream outputStream = new FileOutputStream("/file.pdf"); ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(inputPath); renderer.layout(); renderer.createPDF(outputStream); outputStream.close();
使用js导出pdf
https://stackoverflow.com/questions/19786113/export-html-page-to-pdf-on-user-click-using-javascript
itext:
https://stackoverflow.com/questions/235851/using-itext-to-convert-html-to-pdf/311303#311303
https://www.tutorialspoint.com/springmvc/springmvc_pdf.htm
https://memorynotfound.com/spring-mvc-pdf-view-example/
https://www.roseindia.net/tutorial/spring/spring3/web/spring-3-mvc-fileupload-example.html
http://hmkcode.com/spring-mvc-view-json-xml-pdf-or-excel/