只在pdf中添加水印
This commit is contained in:
@@ -288,7 +288,19 @@ public class AttFileEOController {
|
|||||||
WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent);
|
WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent);
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||||
response.setContentType("application/octet-stream");
|
response.setContentType("application/octet-stream");
|
||||||
File file = new File(waterFilePath);
|
|
||||||
|
String downloadFilePath="";
|
||||||
|
String fileName=attFileEO.getFileName();
|
||||||
|
String suffix=fileName.substring(fileName.lastIndexOf(".")+1);
|
||||||
|
//只能在pdf中添加水印,
|
||||||
|
//非pdf文件直接下载原文件
|
||||||
|
if (suffix.equals("pdf")){
|
||||||
|
downloadFilePath=waterFilePath;
|
||||||
|
}else {
|
||||||
|
downloadFilePath=oldFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(downloadFilePath);
|
||||||
is = new FileInputStream(file);
|
is = new FileInputStream(file);
|
||||||
os = response.getOutputStream();
|
os = response.getOutputStream();
|
||||||
IOUtils.copy(is, os);
|
IOUtils.copy(is, os);
|
||||||
|
|||||||
Reference in New Issue
Block a user