SpringMvc controller
@RequestMapping("/exportDailyPdf")
public void exportDailyPdf(HttpServletRequest request,HttpServletResponse response){
Document document = new Document(PageSize.A4);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
PdfWriter writer = PdfWriter.getInstance(document, stream);
//设置文档作者
document.addAuthor("Hutton");
//设置文档标题
document.addTitle("this is itext pdf file");
//设置主题
document.addSubject("First PDF");
//设置关键字
document.addKeywords("iText");
//打开文档
document.open();
//在pdf文件中写入文字
document.add(new Paragraph("导出数据"));
//BaseFont bfChinese = BaseFont.createFont("C:/windows/fonts/simsun.ttc,1",BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
<span style="white-space:pre"> </span>BaseFont bfChinese = BaseFont.createFont(this.getClass().getResource("") + "/SIMSUN.TTC,1",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
//正文字体风格
Font contextFont = new Font(bfChinese,10,Font.NORMAL);
float[] widths = {25f, 25f, 35f,25f, 25f, 25f,25f, 25f, 25f};// 设置表格的列宽和列数 默认是4列
PdfPTable table = new PdfPTable(widths);// 建立一个pdf表格
table.setSpacingBefore(20f);
table.setWidthPercentage(100);// 设置表格宽度为100%
processDailyPdfTableHead(table, contextFont);
Map<String,String> params = this.processDaily(request);
List<DailyExp