使用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/
 

转载于:https://www.cnblogs.com/yangcw/p/9038528.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值