best2018
2022-09-26 13:37:32
证
SpringBoot Html转PDF SpringBoot转换网页为PDF
项目描述
SpringBoot项目,将在线网页转换成PDF进行下载;使用wkhtmltox将Html网页转换成PDF文件进行下载。
运行环境
jdk8+tomcat8+IntelliJ IDEA+maven
项目技术(必填)
springboot + html
数据库文件(可选)
无
依赖包文件(可选)
Maven管理依赖所需JAR包
链接:https://pan.baidu.com/s/1r1UgXG_E_oSgzUQQ1wByTg?pwd=sk3u
提取码:sk3u
资源包文件(可选)
测试使用文件及HTML存放于resources/static目录下(404.html,test.jpg)
https://wkhtmltopdf.org/downloads.html
运行视频(可选)
无
是否原创(转载必填原文地址)
原创
项目截图(必填)
运行截图(必填)
http://localhost:8080/index
注意事项(可选)
项目成功运行前提:
1.需要本地安装wkhtmltox-0.12.6-1.msvc2015-win64.rar,请于wkhtmltopdf官网下载对应软件版本。
软件安装后的路径配置到PdfFileCreator.java文件中。示例如下(也可以自行迁移至application.yml中):
List<String> pdfCommand = Arrays.asList( // "wkhtmltopdf", "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe", sourceHtmlUrl, "-" );
wkhtmltopdf官网地址:
https://wkhtmltopdf.org/downloads.html
相关配置详见src/resources/application.yml中
2.如果想要把带有中文的html文件转换为正确编码的pdf文件,需要指定正确的html head头
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
请下载代码后再发表评论
文件名:springboot-pdf-master.zip,文件大小:75.858K
下载
- /
- /springboot-pdf-master
- /springboot-pdf-master/.gitignore
- /springboot-pdf-master/.idea
- /springboot-pdf-master/.idea/.gitignore
- /springboot-pdf-master/.idea/compiler.xml
- /springboot-pdf-master/.idea/encodings.xml
- /springboot-pdf-master/.idea/inspectionProfiles
- /springboot-pdf-master/.idea/inspectionProfiles/Project_Default.xml
- /springboot-pdf-master/.idea/jarRepositories.xml
- /springboot-pdf-master/.idea/libraries
- /springboot-pdf-master/src
- /springboot-pdf-master/src/main
- /springboot-pdf-master/src/main/java
- /springboot-pdf-master/src/main/java/com
- /springboot-pdf-master/src/main/java/com/example
- /springboot-pdf-master/src/main/java/com/example/demo
- /springboot-pdf-master/src/main/java/com/example/demo/controller
- /springboot-pdf-master/src/main/java/com/example/demo/model
- /springboot-pdf-master/src/main/java/com/example/demo/service
- /springboot-pdf-master/src/main/java/com/example/demo
- /springboot-pdf-master/src/main/java/com/example
- /springboot-pdf-master/src/main/java/com
- /springboot-pdf-master/src/main/java
- /springboot-pdf-master/src/main
- /springboot-pdf-master
相关代码
- 证 pdf.worker.js实现前端转换pdf文件为图片文件
- 证 java通过pdfbox转换pdf文件为word文档
- java转换excel为pdf文件
- java文本、表格word转换生成PDF加密文件代码下载
- java实现TXT自动读取转换PDF并且加密水印
- 原 spring mvc简单的图片与PDF文件互转
- html页面pdf文件展示
- 原精 java开源pdf框架pdfbox实现pdf文档后台打印,多个pdf文件合并
- 原 apache poi导出Excel或Pdf文件的工具类
- PDF文件在线浏览javascript控件
- java生成pdf,加水印,加页眉页脚,使用itext 5+版本
- 原 java+vuejs导出pdf和word文件
最近下载
最近浏览
2716804680 LV9
4月20日
2317696509 LV6
2023年12月15日
chenlie LV2
2023年11月13日
内心向阳 LV4
2023年11月7日
13043860zj LV16
2023年10月31日
pizizhang
2023年10月20日
暂无贡献等级
graceful
2023年10月18日
暂无贡献等级
WHY-small LV15
2023年7月5日
liminshabi LV2
2023年5月11日
tmdgdx LV9
2023年4月14日