|
@@ -1,10 +1,10 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
-import com.aspose.cells.LoadFormat;
|
|
|
-import com.aspose.cells.LoadOptions;
|
|
|
-import com.aspose.cells.PdfSaveOptions;
|
|
|
import com.aspose.cells.*;
|
|
|
-import com.aspose.pdf.*;
|
|
|
+import com.aspose.pdf.FontRepository;
|
|
|
+import com.aspose.pdf.Page;
|
|
|
+import com.aspose.pdf.TextStamp;
|
|
|
+import com.aspose.pdf.TextState;
|
|
|
import com.aspose.words.Document;
|
|
|
import com.aspose.words.FontSettings;
|
|
|
import com.aspose.words.SaveOptions;
|
|
@@ -168,7 +168,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
|
|
|
g2d.dispose();
|
|
|
// 设置响应类型
|
|
|
if ("JPEG".equalsIgnoreCase(formatName) || "JPG".equalsIgnoreCase(formatName)) {
|
|
|
- response.setContentType("image/jpeg");
|
|
|
+ response.setContentType(QHSEConstant.ContentType.JPG);
|
|
|
// 处理JPEG透明度
|
|
|
BufferedImage jpegImage = new BufferedImage(
|
|
|
newImage.getWidth(),
|
|
@@ -180,11 +180,11 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
|
|
|
g.dispose();
|
|
|
ImageIO.write(jpegImage, formatName, out);
|
|
|
} else {
|
|
|
- response.setContentType("image/png");
|
|
|
+ response.setContentType(QHSEConstant.ContentType.PNG);
|
|
|
ImageIO.write(newImage, formatName, out);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.error("图片处理失败", e);
|
|
|
+ log.error("图片加水印处理失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
|
|
|
throw new CustomException("文件处理异常");
|
|
|
}
|
|
|
}
|