测试使用文件及HTML存放于resources/static目录下(404.html,test.jpg)
https://wkhtmltopdf.org/downloads.html
运行视频(可选)
是否原创(转载必填原文地址)
项目截图(必填)
运行截图(必填)
http://localhost:8080/index
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
-
/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