office 功能调整 支持批注 转换页码限制 生成水印等等
This commit is contained in:
@ -131,30 +131,30 @@ beian = ${KK_BEIAN:default}
|
|||||||
#禁止上传类型
|
#禁止上传类型
|
||||||
prohibit = ${KK_PROHIBIT:exe,dll,dat}
|
prohibit = ${KK_PROHIBIT:exe,dll,dat}
|
||||||
#启用验证码删除文件 默认关闭
|
#启用验证码删除文件 默认关闭
|
||||||
delete.captcha= ${KK_DELETE_CAPTCHA:true}
|
delete.captcha= ${KK_DELETE_CAPTCHA:false}
|
||||||
#删除密码
|
#删除密码
|
||||||
delete.password = ${KK_DELETE_PASSWORD:123456}
|
delete.password = ${KK_DELETE_PASSWORD:123456}
|
||||||
#删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
|
#删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
|
||||||
delete.source.file = ${KK_DELETE_SOURCE_FILE:false}
|
delete.source.file = ${KK_DELETE_SOURCE_FILE:true}
|
||||||
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
|
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
|
||||||
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
|
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
|
||||||
#xlsx格式前端解析
|
#xlsx格式前端解析
|
||||||
office.type.web = ${KK_OFFICE_TYPE_WEB:web}
|
office.type.web = ${KK_OFFICE_TYPE_WEB:web}
|
||||||
#Cad类型图片浏览模式:tif(利用前端js插件浏览);svg(转换为svg显示);pdf(转换为pdf后显示,便于打印)
|
#Cad类型图片浏览模式:tif(利用前端js插件浏览);svg(转换为svg显示);pdf(转换为pdf后显示,便于打印)
|
||||||
cad.preview.type = ${KK_CAD_PREVIEW_TYPE:svg}
|
cad.preview.type = ${KK_CAD_PREVIEW_TYPE:pdf}
|
||||||
|
|
||||||
#OFFICE转换模块设置
|
#OFFICE转换模块设置
|
||||||
#生成限制 默认不限制 使用方法 (1-5)
|
#生成限制 默认不限制 使用方法 (1-5)
|
||||||
office.pagerange = ${KK_office_PageRange:false}
|
office.pagerange = ${KK_OFFICE_PAGERANGE:false}
|
||||||
#生成水印 默认不启用 使用方法 (kkFileView)
|
#生成水印 默认不启用 使用方法 (kkFileView)
|
||||||
office.watermark = ${KK_office_Watermark:false}
|
office.watermark = ${KK_OFFICE_WATERMARK:false}
|
||||||
#OFFICE JPEG图片压缩
|
#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的注释
|
#批注作为PDF的注释
|
||||||
office.exportnotes = ${KK_office_ExportNotes:true}
|
office.exportnotes = ${KK_OFFICE_EXPORTNOTES:true}
|
||||||
#加密文档 生成的PDF文档 添加密码(密码为加密文档的密码)
|
#加密文档 生成的PDF文档 添加密码(密码为加密文档的密码)
|
||||||
office.documentopenpasswords = ${KK_office_DocumentOpenPassword:true}
|
office.documentopenpasswords = ${KK_OFFICE_DOCUMENTOPENPASSWORD:true}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class ConfigConstants {
|
|||||||
public static final String DEFAULT_OFFICE_MAXIMAQERESOLUTION = "150";
|
public static final String DEFAULT_OFFICE_MAXIMAQERESOLUTION = "150";
|
||||||
public static final String DEFAULT_OFFICE_EXPORTBOOKMARKS = "true";
|
public static final String DEFAULT_OFFICE_EXPORTBOOKMARKS = "true";
|
||||||
public static final String DEFAULT_OFFICE_EXPORTNOTES = "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() {
|
public static Boolean isCacheEnabled() {
|
||||||
return cacheEnabled;
|
return cacheEnabled;
|
||||||
@ -499,81 +499,81 @@ public class ConfigConstants {
|
|||||||
* 以下为OFFICE转换模块设置
|
* 以下为OFFICE转换模块设置
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static String getofficePageRange() {
|
public static String getOfficePageRange() {
|
||||||
return officePageRange;
|
return officePageRange;
|
||||||
}
|
}
|
||||||
@Value("${office.pagerange:false}")
|
@Value("${office.pagerange:false}")
|
||||||
public void setOfficePageRange(String officepagerange) {
|
public void setOfficePageRange(String officePageRange) {
|
||||||
setOfficePageRangeValue(officepagerange);
|
setOfficePageRangeValue(officePageRange);
|
||||||
}
|
}
|
||||||
public static void setOfficePageRangeValue(String officepagerange) {
|
public static void setOfficePageRangeValue(String officePageRange) {
|
||||||
ConfigConstants.officePageRange = officepagerange;
|
ConfigConstants.officePageRange = officePageRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getofficeWatermark() {
|
public static String getOfficeWatermark() {
|
||||||
return officeWatermark;
|
return officeWatermark;
|
||||||
}
|
}
|
||||||
@Value("${office.watermark:false}")
|
@Value("${office.watermark:false}")
|
||||||
public void setOfficeWatermark(String officewatermark) {
|
public void setOfficeWatermark(String officeWatermark) {
|
||||||
setOfficeWatermarkValue(officewatermark);
|
setOfficeWatermarkValue(officeWatermark);
|
||||||
}
|
}
|
||||||
public static void setOfficeWatermarkValue(String officewatermark) {
|
public static void setOfficeWatermarkValue(String officeWatermark) {
|
||||||
ConfigConstants.officeWatermark = officewatermark;
|
ConfigConstants.officeWatermark = officeWatermark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getofficeQuality() {
|
public static String getOfficeQuality() {
|
||||||
return officeQuality;
|
return officeQuality;
|
||||||
}
|
}
|
||||||
@Value("${office.Quality:80}")
|
@Value("${office.quality:80}")
|
||||||
public void setOfficeQuality(String officequality) {
|
public void setOfficeQuality(String officeQuality) {
|
||||||
setOfficeQualityValue(officequality);
|
setOfficeQualityValue(officeQuality);
|
||||||
}
|
}
|
||||||
public static void setOfficeQualityValue(String officequality) {
|
public static void setOfficeQualityValue(String officeQuality) {
|
||||||
ConfigConstants.officeQuality = officequality;
|
ConfigConstants.officeQuality = officeQuality;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getofficeMaxImageResolution() {
|
public static String getOfficeMaxImageResolution() {
|
||||||
return officeMaxImageResolution;
|
return officeMaxImageResolution;
|
||||||
}
|
}
|
||||||
@Value("${office.maximageresolution:150}")
|
@Value("${office.maximageresolution:150}")
|
||||||
public void setofficeMaxImageResolution(String officemaximageresolution) {
|
public void setOfficeMaxImageResolution(String officeMaxImageResolution) {
|
||||||
setOfficeMaxImageResolutionValue(officemaximageresolution);
|
setOfficeMaxImageResolutionValue(officeMaxImageResolution);
|
||||||
}
|
}
|
||||||
public static void setOfficeMaxImageResolutionValue(String officemaximageresolution) {
|
public static void setOfficeMaxImageResolutionValue(String officeMaxImageResolution) {
|
||||||
ConfigConstants.officeMaxImageResolution = officemaximageresolution;
|
ConfigConstants.officeMaxImageResolution = officeMaxImageResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getofficeExportBookmarks() {
|
public static Boolean getOfficeExportBookmarks() {
|
||||||
return officeExportBookmarks;
|
return officeExportBookmarks;
|
||||||
}
|
}
|
||||||
@Value("${office.exportbookmarks:true}")
|
@Value("${office.exportbookmarks:true}")
|
||||||
public void setofficeExportBookmarks(Boolean officeexportbookmarks) {
|
public void setOfficeExportBookmarks(Boolean officeExportBookmarks) {
|
||||||
setOfficeExportBookmarksValue(officeexportbookmarks);
|
setOfficeExportBookmarksValue(officeExportBookmarks);
|
||||||
}
|
}
|
||||||
public static void setOfficeExportBookmarksValue(Boolean officeexportbookmarks) {
|
public static void setOfficeExportBookmarksValue(Boolean officeExportBookmarks) {
|
||||||
ConfigConstants.officeExportBookmarks = officeexportbookmarks;
|
ConfigConstants.officeExportBookmarks = officeExportBookmarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getofficeExportNotes() {
|
public static Boolean getOfficeExportNotes() {
|
||||||
return officeExportNotes;
|
return officeExportNotes;
|
||||||
}
|
}
|
||||||
@Value("${office.exportnotes:true}")
|
@Value("${office.exportnotes:true}")
|
||||||
public void setExportNotes(Boolean officeofficeexportnotes) {
|
public void setExportNotes(Boolean officeExportNotes) {
|
||||||
setOfficeExportNotesValue(officeofficeexportnotes);
|
setOfficeExportNotesValue(officeExportNotes);
|
||||||
}
|
}
|
||||||
public static void setOfficeExportNotesValue(Boolean officeofficeexportnotes) {
|
public static void setOfficeExportNotesValue(Boolean officeExportNotes) {
|
||||||
ConfigConstants.officeExportNotes = officeofficeexportnotes;
|
ConfigConstants.officeExportNotes = officeExportNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getofficeDocumentOpenPasswords() {
|
public static Boolean getOfficeDocumentOpenPasswords() {
|
||||||
return officeDocumentOpenPasswords;
|
return officeDocumentOpenPasswords;
|
||||||
}
|
}
|
||||||
@Value("${office.documentopenpasswords:true}")
|
@Value("${office.documentopenpasswords:true}")
|
||||||
public void setDocumentOpenPasswords(Boolean officedocumentopenpasswords) {
|
public void setDocumentOpenPasswords(Boolean officeDocumentOpenPasswords) {
|
||||||
setOfficeDocumentOpenPasswordsValue(officedocumentopenpasswords);
|
setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
|
||||||
}
|
}
|
||||||
public static void setOfficeDocumentOpenPasswordsValue(Boolean officedocumentopenpasswords) {
|
public static void setOfficeDocumentOpenPasswordsValue(Boolean officeDocumentOpenPasswords) {
|
||||||
ConfigConstants.officeDocumentOpenPasswords = officedocumentopenpasswords;
|
ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class ConfigRefreshComponent {
|
|||||||
officMaxImageResolution = properties.getProperty("office.maximageresolution", ConfigConstants.DEFAULT_OFFICE_MAXIMAQERESOLUTION);
|
officMaxImageResolution = properties.getProperty("office.maximageresolution", ConfigConstants.DEFAULT_OFFICE_MAXIMAQERESOLUTION);
|
||||||
officExportBookmarks = Boolean.parseBoolean(properties.getProperty("office.exportbookmarks", ConfigConstants.DEFAULT_OFFICE_EXPORTBOOKMARKS));
|
officExportBookmarks = Boolean.parseBoolean(properties.getProperty("office.exportbookmarks", ConfigConstants.DEFAULT_OFFICE_EXPORTBOOKMARKS));
|
||||||
officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES));
|
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(",");
|
prohibitArray = prohibit.split(",");
|
||||||
|
|
||||||
ConfigConstants.setCacheEnabledValueValue(cacheEnabled);
|
ConfigConstants.setCacheEnabledValueValue(cacheEnabled);
|
||||||
|
|||||||
@ -36,21 +36,21 @@ public class OfficeToPdfService {
|
|||||||
LocalConverter.Builder builder;
|
LocalConverter.Builder builder;
|
||||||
Map<String, Object> filterData = new HashMap<>();
|
Map<String, Object> filterData = new HashMap<>();
|
||||||
filterData.put("EncryptFile", true);
|
filterData.put("EncryptFile", true);
|
||||||
if(!ConfigConstants.getofficePageRange().equals("false")){
|
if(!ConfigConstants.getOfficePageRange().equals("false")){
|
||||||
filterData.put("PageRange", ConfigConstants.getofficePageRange()); //限制页面
|
filterData.put("PageRange", ConfigConstants.getOfficePageRange()); //限制页面
|
||||||
}
|
}
|
||||||
if(!ConfigConstants.getofficeWatermark().equals("false")){
|
if(!ConfigConstants.getOfficeWatermark().equals("false")){
|
||||||
filterData.put("Watermark", ConfigConstants.getofficeWatermark()); //水印
|
filterData.put("Watermark", ConfigConstants.getOfficeWatermark()); //水印
|
||||||
}
|
}
|
||||||
filterData.put("Quality", ConfigConstants.getofficeQuality()); //图片压缩
|
filterData.put("Quality", ConfigConstants.getOfficeQuality()); //图片压缩
|
||||||
filterData.put("MaxImageResolution", ConfigConstants.getofficeMaxImageResolution()); //DPI
|
filterData.put("MaxImageResolution", ConfigConstants.getOfficeMaxImageResolution()); //DPI
|
||||||
if(ConfigConstants.getofficeExportBookmarks()){
|
if(ConfigConstants.getOfficeExportBookmarks()){
|
||||||
filterData.put("ExportBookmarks", true); //导出书签
|
filterData.put("ExportBookmarks", true); //导出书签
|
||||||
}
|
}
|
||||||
if(ConfigConstants.getofficeExportNotes()){
|
if(ConfigConstants.getOfficeExportNotes()){
|
||||||
filterData.put("ExportNotes", true); //批注作为PDF的注释
|
filterData.put("ExportNotes", true); //批注作为PDF的注释
|
||||||
}
|
}
|
||||||
if(!ConfigConstants.getofficeDocumentOpenPasswords()){
|
if(!ConfigConstants.getOfficeDocumentOpenPasswords()){
|
||||||
filterData.put("DocumentOpenPassword", fileAttribute.getFilePassword()); //给PDF添加密码
|
filterData.put("DocumentOpenPassword", fileAttribute.getFilePassword()); //给PDF添加密码
|
||||||
}
|
}
|
||||||
Map<String, Object> customProperties = new HashMap<>();
|
Map<String, Object> customProperties = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user