1、在pom.xml文件中配置itext的依赖包
<!-- itext方式导出pdf -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>4.2.2</version>
</dependency>
2.下载pdf核心代码
// 下载pdf文档
@RequestMapping("/downloadPdf")
public void downloadPdf(HttpServletRequest request, HttpServletResponse response) throws Exception {
// 告诉浏览器用什么软件可以打开此文件
response.setHeader("content-Type", "application/pdf");
// 下载文件的默认名称
response.setHeader("Content-Disposition", "attachment;fil