소스 검색

office 功能调整 支持批注 转换页码限制 生成水印等等

陈精华 1 년 전
부모
커밋
7965d52f29

+ 10 - 10
server/src/main/config/application.properties

@@ -131,30 +131,30 @@ beian = ${KK_BEIAN:default}
 #禁止上传类型
 prohibit = ${KK_PROHIBIT:exe,dll,dat}
 #启用验证码删除文件 默认关闭
-delete.captcha= ${KK_DELETE_CAPTCHA:true}
+delete.captcha= ${KK_DELETE_CAPTCHA:false}
 #删除密码
 delete.password = ${KK_DELETE_PASSWORD:123456}
 #删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
-delete.source.file = ${KK_DELETE_SOURCE_FILE:false}
+delete.source.file = ${KK_DELETE_SOURCE_FILE:true}
 #配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
 pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
 #xlsx格式前端解析
 office.type.web = ${KK_OFFICE_TYPE_WEB:web}
 #Cad类型图片浏览模式:tif(利用前端js插件浏览);svg(转换为svg显示);pdf(转换为pdf后显示,便于打印)
-cad.preview.type = ${KK_CAD_PREVIEW_TYPE:svg}
+cad.preview.type = ${KK_CAD_PREVIEW_TYPE:pdf}
 
 #OFFICE转换模块设置
 #生成限制 默认不限制 使用方法 (1-5)
-office.pagerange = ${KK_office_PageRange:false}
+office.pagerange = ${KK_OFFICE_PAGERANGE:false}
 #生成水印 默认不启用 使用方法 (kkFileView)
-office.watermark  = ${KK_office_Watermark:false}
+office.watermark  = ${KK_OFFICE_WATERMARK:false}
 #OFFICE JPEG图片压缩
-office.quality = ${KK_office_Quality:80}
+office.quality = ${KK_OFFICE_QUALITY:80}
 #图像分辨率限制
-office.maximageresolution = ${KK_office_MaxImageResolution:150}
+office.maximageresolution = ${KK_OFFICE_MAXIMAGERESOLUTION:150}
 #导出书签
-office.exportbookmarks = ${KK_office_ExportBookmarks:true}
+office.exportbookmarks = ${KK_OFFICE_EXPORTBOOKMARKS:true}
 #批注作为PDF的注释
-office.exportnotes = ${KK_office_ExportNotes:true}
+office.exportnotes = ${KK_OFFICE_EXPORTNOTES:true}
 #加密文档 生成的PDF文档 添加密码(密码为加密文档的密码)
-office.documentopenpasswords = ${KK_office_DocumentOpenPassword:true}
+office.documentopenpasswords = ${KK_OFFICE_DOCUMENTOPENPASSWORD:true}

+ 37 - 37
server/src/main/java/cn/keking/config/ConfigConstants.java

@@ -95,7 +95,7 @@ public class ConfigConstants {
     public static final String DEFAULT_OFFICE_MAXIMAQERESOLUTION = "150";
     public static final String DEFAULT_OFFICE_EXPORTBOOKMARKS = "true";
     public static final String DEFAULT_OFFICE_EXPORTNOTES = "true";
-    public static final String DEFAULT_EOCUMENTOPENPASSWORDS = "true";
+    public static final String DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS = "true";
 
     public static Boolean isCacheEnabled() {
         return cacheEnabled;
@@ -499,81 +499,81 @@ public class ConfigConstants {
      * 以下为OFFICE转换模块设置
      */
 
-    public static String getofficePageRange() {
+    public static String getOfficePageRange() {
         return officePageRange;
     }
     @Value("${office.pagerange:false}")
-    public void setOfficePageRange(String officepagerange) {
-        setOfficePageRangeValue(officepagerange);
+    public void setOfficePageRange(String officePageRange) {
+        setOfficePageRangeValue(officePageRange);
     }
-    public static void setOfficePageRangeValue(String officepagerange) {
-        ConfigConstants.officePageRange = officepagerange;
+    public static void setOfficePageRangeValue(String officePageRange) {
+        ConfigConstants.officePageRange = officePageRange;
     }
 
-    public static String getofficeWatermark() {
+    public static String getOfficeWatermark() {
         return officeWatermark;
     }
     @Value("${office.watermark:false}")
-    public void setOfficeWatermark(String officewatermark) {
-        setOfficeWatermarkValue(officewatermark);
+    public void setOfficeWatermark(String officeWatermark) {
+        setOfficeWatermarkValue(officeWatermark);
     }
-    public static void setOfficeWatermarkValue(String officewatermark) {
-        ConfigConstants.officeWatermark = officewatermark;
+    public static void setOfficeWatermarkValue(String officeWatermark) {
+        ConfigConstants.officeWatermark = officeWatermark;
     }
 
-    public static String getofficeQuality() {
+    public static String getOfficeQuality() {
         return officeQuality;
     }
-    @Value("${office.Quality:80}")
-    public void setOfficeQuality(String officequality) {
-        setOfficeQualityValue(officequality);
+    @Value("${office.quality:80}")
+    public void setOfficeQuality(String officeQuality) {
+        setOfficeQualityValue(officeQuality);
     }
-    public static void setOfficeQualityValue(String officequality) {
-        ConfigConstants.officeQuality = officequality;
+    public static void setOfficeQualityValue(String officeQuality) {
+        ConfigConstants.officeQuality = officeQuality;
     }
 
-    public static String getofficeMaxImageResolution() {
+    public static String getOfficeMaxImageResolution() {
         return officeMaxImageResolution;
     }
     @Value("${office.maximageresolution:150}")
-    public void setofficeMaxImageResolution(String officemaximageresolution) {
-        setOfficeMaxImageResolutionValue(officemaximageresolution);
+    public void setOfficeMaxImageResolution(String officeMaxImageResolution) {
+        setOfficeMaxImageResolutionValue(officeMaxImageResolution);
     }
-    public static void setOfficeMaxImageResolutionValue(String officemaximageresolution) {
-        ConfigConstants.officeMaxImageResolution = officemaximageresolution;
+    public static void setOfficeMaxImageResolutionValue(String officeMaxImageResolution) {
+        ConfigConstants.officeMaxImageResolution = officeMaxImageResolution;
     }
 
-    public static Boolean getofficeExportBookmarks() {
+    public static Boolean getOfficeExportBookmarks() {
         return officeExportBookmarks;
     }
     @Value("${office.exportbookmarks:true}")
-    public void setofficeExportBookmarks(Boolean officeexportbookmarks) {
-        setOfficeExportBookmarksValue(officeexportbookmarks);
+    public void setOfficeExportBookmarks(Boolean officeExportBookmarks) {
+        setOfficeExportBookmarksValue(officeExportBookmarks);
     }
-    public static void setOfficeExportBookmarksValue(Boolean officeexportbookmarks) {
-        ConfigConstants.officeExportBookmarks = officeexportbookmarks;
+    public static void setOfficeExportBookmarksValue(Boolean officeExportBookmarks) {
+        ConfigConstants.officeExportBookmarks = officeExportBookmarks;
     }
 
-    public static Boolean getofficeExportNotes() {
+    public static Boolean getOfficeExportNotes() {
         return officeExportNotes;
     }
     @Value("${office.exportnotes:true}")
-    public void setExportNotes(Boolean officeofficeexportnotes) {
-        setOfficeExportNotesValue(officeofficeexportnotes);
+    public void setExportNotes(Boolean officeExportNotes) {
+        setOfficeExportNotesValue(officeExportNotes);
     }
-    public static void setOfficeExportNotesValue(Boolean officeofficeexportnotes) {
-        ConfigConstants.officeExportNotes = officeofficeexportnotes;
+    public static void setOfficeExportNotesValue(Boolean officeExportNotes) {
+        ConfigConstants.officeExportNotes = officeExportNotes;
     }
 
-    public static Boolean getofficeDocumentOpenPasswords() {
+    public static Boolean getOfficeDocumentOpenPasswords() {
         return officeDocumentOpenPasswords;
     }
     @Value("${office.documentopenpasswords:true}")
-    public void setDocumentOpenPasswords(Boolean officedocumentopenpasswords) {
-        setOfficeDocumentOpenPasswordsValue(officedocumentopenpasswords);
+    public void setDocumentOpenPasswords(Boolean officeDocumentOpenPasswords) {
+        setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
     }
-    public static void setOfficeDocumentOpenPasswordsValue(Boolean officedocumentopenpasswords) {
-        ConfigConstants.officeDocumentOpenPasswords = officedocumentopenpasswords;
+    public static void setOfficeDocumentOpenPasswordsValue(Boolean officeDocumentOpenPasswords) {
+        ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords;
     }
 
 }

+ 1 - 1
server/src/main/java/cn/keking/config/ConfigRefreshComponent.java

@@ -109,7 +109,7 @@ public class ConfigRefreshComponent {
                     officMaxImageResolution = properties.getProperty("office.maximageresolution", ConfigConstants.DEFAULT_OFFICE_MAXIMAQERESOLUTION);
                     officExportBookmarks = Boolean.parseBoolean(properties.getProperty("office.exportbookmarks", ConfigConstants.DEFAULT_OFFICE_EXPORTBOOKMARKS));
                     officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES));
-                    officeDocumentOpenPasswords =  Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_EOCUMENTOPENPASSWORDS));
+                    officeDocumentOpenPasswords =  Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS));
                     prohibitArray = prohibit.split(",");
 
                     ConfigConstants.setCacheEnabledValueValue(cacheEnabled);

+ 9 - 9
server/src/main/java/cn/keking/service/OfficeToPdfService.java

@@ -36,21 +36,21 @@ public class OfficeToPdfService {
         LocalConverter.Builder builder;
         Map<String, Object> filterData = new HashMap<>();
         filterData.put("EncryptFile", true);
-        if(!ConfigConstants.getofficePageRange().equals("false")){
-            filterData.put("PageRange", ConfigConstants.getofficePageRange()); //限制页面
+        if(!ConfigConstants.getOfficePageRange().equals("false")){
+            filterData.put("PageRange", ConfigConstants.getOfficePageRange()); //限制页面
         }
-        if(!ConfigConstants.getofficeWatermark().equals("false")){
-            filterData.put("Watermark", ConfigConstants.getofficeWatermark());  //水印
+        if(!ConfigConstants.getOfficeWatermark().equals("false")){
+            filterData.put("Watermark", ConfigConstants.getOfficeWatermark());  //水印
         }
-        filterData.put("Quality", ConfigConstants.getofficeQuality()); //图片压缩
-        filterData.put("MaxImageResolution", ConfigConstants.getofficeMaxImageResolution()); //DPI
-        if(ConfigConstants.getofficeExportBookmarks()){
+        filterData.put("Quality", ConfigConstants.getOfficeQuality()); //图片压缩
+        filterData.put("MaxImageResolution", ConfigConstants.getOfficeMaxImageResolution()); //DPI
+        if(ConfigConstants.getOfficeExportBookmarks()){
             filterData.put("ExportBookmarks", true); //导出书签
         }
-        if(ConfigConstants.getofficeExportNotes()){
+        if(ConfigConstants.getOfficeExportNotes()){
             filterData.put("ExportNotes", true); //批注作为PDF的注释
         }
-        if(!ConfigConstants.getofficeDocumentOpenPasswords()){
+        if(!ConfigConstants.getOfficeDocumentOpenPasswords()){
             filterData.put("DocumentOpenPassword", fileAttribute.getFilePassword()); //给PDF添加密码
         }
         Map<String, Object> customProperties = new HashMap<>();