导出 pdf 不预览, 直接下载
String pdfUrl = "D:\\test\\data.pdf";
try {
File file = new File(pdfUrl);
BufferedInputStream bis = null;
OutputStream os = null;
FileInputStream fileInputStream = null;
res.setCharacterEncoding("utf-8");
res.setContentType("application/pdf");
res.setContentType("application/force-download");
res.setHeader("Content-Disposition", "attachment; filename=" + "reviewer.pdf");
try {
fileInputStream = new FileInputStream(file);
byte[] buff = new byte[1024];
bis = new BufferedInputStream(fileInputStream);
os = res.getOutputStream();
int i = bis.read(buff);
while (i != -1